Skip to content

Commit 86782fc

Browse files
authored
Fix no callback when the server is disconnected on Windows (#548)
1 parent 8f00664 commit 86782fc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ixwebsocket/IXNetSystem.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ namespace ix
140140

141141
// mapping
142142
long networkEvents = 0;
143-
if (fd->events & (POLLIN )) networkEvents |= FD_READ | FD_ACCEPT;
143+
if (fd->events & (POLLIN )) networkEvents |= FD_READ | FD_ACCEPT | FD_CLOSE;
144144
if (fd->events & (POLLOUT /*| POLLWRNORM | POLLWRBAND*/)) networkEvents |= FD_WRITE | FD_CONNECT;
145145
//if (fd->events & (POLLPRI | POLLRDBAND )) networkEvents |= FD_OOB;
146146

@@ -183,8 +183,9 @@ namespace ix
183183
else if (netEvents.lNetworkEvents != 0)
184184
{
185185
// mapping
186-
if (netEvents.lNetworkEvents & (FD_READ | FD_ACCEPT | FD_OOB)) fd->revents |= POLLIN;
187-
if (netEvents.lNetworkEvents & (FD_WRITE | FD_CONNECT )) fd->revents |= POLLOUT;
186+
if (netEvents.lNetworkEvents & (FD_READ | FD_ACCEPT | FD_OOB | FD_CLOSE)) fd->revents |= POLLIN;
187+
if (netEvents.lNetworkEvents & (FD_WRITE | FD_CONNECT )) fd->revents |= POLLOUT;
188+
if (netEvents.lNetworkEvents & (FD_CLOSE )) fd->revents |= POLLHUP;
188189

189190
for (int i = 0; i < FD_MAX_EVENTS; ++i)
190191
{

0 commit comments

Comments
 (0)