diff --git a/ChangeLog.txt b/ChangeLog.txt index 46e45e39..f4a9ddcf 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -33,6 +33,7 @@ Broker: - Allow broker to always restart on Windows when using `log_dest file`. Closes #1080. - Fix Will not being sent for Websockets clients. Closes #1143. +- Windows: Fix possible crash when client disconnects. Closes #1137. Library: - Fix TLS connections not working over SOCKS. diff --git a/src/websockets.c b/src/websockets.c index 163c222e..4db2e8df 100644 --- a/src/websockets.c +++ b/src/websockets.c @@ -247,7 +247,7 @@ static int callback_mqtt(struct libwebsocket_context *context, } mosq = u->mosq; if(mosq){ - if(mosq->sock > 0){ + if(mosq->sock != INVALID_SOCKET){ HASH_DELETE(hh_sock, db->contexts_by_sock, mosq); mosq->sock = INVALID_SOCKET; mosq->pollfd_index = -1;