mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 02:47:56 +08:00
Optimize fiber event for supporting read/write on the same socket.
This commit is contained in:
parent
e664c947e0
commit
9df7c8d7b1
@ -86,12 +86,14 @@ int acl_write_wait_ms(ACL_SOCKET fd, int timeout)
|
||||
}
|
||||
|
||||
if ((fds.revents & (POLLHUP | POLLERR))) {
|
||||
/*
|
||||
acl_msg_error("%s(%d), %s: %s, %s, %s, fd=%d",
|
||||
__FILE__, __LINE__, myname,
|
||||
acl_last_serror(),
|
||||
fds.revents & POLLHUP ? "POLLHUP" : "0",
|
||||
fds.revents & POLLERR ? "POLLERR" : "0",
|
||||
fd);
|
||||
*/
|
||||
acl_set_error(ACL_ECONNREFUSED);
|
||||
return -1;
|
||||
}
|
||||
|
@ -79,7 +79,9 @@ static void read_callback(EVENT *ev, FILE_EVENT *fe)
|
||||
for (; iter != &fe->pfds; iter = next) {
|
||||
next = next->succ;
|
||||
pfd = ring_to_appl(iter, POLLFD, me);
|
||||
handle_poll_read(ev, fe, pfd);
|
||||
if (pfd->pfd->events & POLLIN) {
|
||||
handle_poll_read(ev, fe, pfd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,7 +131,9 @@ static void write_callback(EVENT *ev, FILE_EVENT *fe)
|
||||
for (; iter != &fe->pfds; iter = next) {
|
||||
next = next->succ;
|
||||
pfd = ring_to_appl(iter, POLLFD, me);
|
||||
handle_poll_write(ev, fe, pfd);
|
||||
if (pfd->pfd->events & POLLOUT) {
|
||||
handle_poll_write(ev, fe, pfd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user