Optimize fiber event for supporting read/write on the same socket.

This commit is contained in:
zhengshuxin 2023-06-26 12:04:27 +08:00
parent e664c947e0
commit 9df7c8d7b1
2 changed files with 8 additions and 2 deletions

View File

@ -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;
}

View File

@ -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);
}
}
}