mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
enable error handle
This commit is contained in:
@@ -55,17 +55,19 @@ sp_add(int kfd, int sock, void *ud) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
sp_enable(int kfd, int sock, void *ud, bool read_enable, bool write_enable) {
|
||||
int ret = 0;
|
||||
struct kevent ke;
|
||||
EV_SET(&ke, sock, EVFILT_READ, read_enable ? EV_ENABLE : EV_DISABLE, 0, 0, ud);
|
||||
if (kevent(kfd, &ke, 1, NULL, 0, NULL) == -1 || ke.flags & EV_ERROR) {
|
||||
// todo: check error
|
||||
ret |= 1;
|
||||
}
|
||||
EV_SET(&ke, sock, EVFILT_WRITE, write_enable ? EV_ENABLE : EV_DISABLE, 0, 0, ud);
|
||||
if (kevent(kfd, &ke, 1, NULL, 0, NULL) == -1 || ke.flags & EV_ERROR) {
|
||||
// todo: check error
|
||||
ret |= 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
Reference in New Issue
Block a user