Skip to content

Commit

Permalink
sock: fix EPOLLOUT always reported for outgoing connections
Browse files Browse the repository at this point in the history
This fixes a bug that caused a socket to be always reported writable
after an outgoing connection was successfully established.
  • Loading branch information
piscisaureus committed Nov 17, 2018
1 parent a9e78ad commit 8b7b340
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/afd.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#define AFD_POLL_DISCONNECT 0x0008
#define AFD_POLL_ABORT 0x0010
#define AFD_POLL_LOCAL_CLOSE 0x0020
#define AFD_POLL_CONNECT 0x0040
#define AFD_POLL_ACCEPT 0x0080
#define AFD_POLL_CONNECT_FAIL 0x0100
/* clang-format on */
Expand Down
4 changes: 2 additions & 2 deletions src/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static inline DWORD sock__epoll_events_to_afd_events(uint32_t epoll_events) {
if (epoll_events & (EPOLLPRI | EPOLLRDBAND))
afd_events |= AFD_POLL_RECEIVE_EXPEDITED;
if (epoll_events & (EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND))
afd_events |= AFD_POLL_SEND | AFD_POLL_CONNECT;
afd_events |= AFD_POLL_SEND;
if (epoll_events & (EPOLLIN | EPOLLRDNORM | EPOLLRDHUP))
afd_events |= AFD_POLL_DISCONNECT;
if (epoll_events & EPOLLHUP)
Expand All @@ -185,7 +185,7 @@ static inline uint32_t sock__afd_events_to_epoll_events(DWORD afd_events) {
epoll_events |= EPOLLIN | EPOLLRDNORM;
if (afd_events & AFD_POLL_RECEIVE_EXPEDITED)
epoll_events |= EPOLLPRI | EPOLLRDBAND;
if (afd_events & (AFD_POLL_SEND | AFD_POLL_CONNECT))
if (afd_events & AFD_POLL_SEND)
epoll_events |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
if (afd_events & AFD_POLL_DISCONNECT)
epoll_events |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP;
Expand Down

0 comments on commit 8b7b340

Please sign in to comment.