Windows: Fix possible crash when client disconnects.

Closes #1137. Thanks to Kris Mattheus.
pull/1600/head
Roger A. Light 7 years ago
parent 0beeee189e
commit 9751cccf0d

@ -33,6 +33,7 @@ Broker:
- Allow broker to always restart on Windows when using `log_dest file`. Closes - Allow broker to always restart on Windows when using `log_dest file`. Closes
#1080. #1080.
- Fix Will not being sent for Websockets clients. Closes #1143. - Fix Will not being sent for Websockets clients. Closes #1143.
- Windows: Fix possible crash when client disconnects. Closes #1137.
Library: Library:
- Fix TLS connections not working over SOCKS. - Fix TLS connections not working over SOCKS.

@ -247,7 +247,7 @@ static int callback_mqtt(struct libwebsocket_context *context,
} }
mosq = u->mosq; mosq = u->mosq;
if(mosq){ if(mosq){
if(mosq->sock > 0){ if(mosq->sock != INVALID_SOCKET){
HASH_DELETE(hh_sock, db->contexts_by_sock, mosq); HASH_DELETE(hh_sock, db->contexts_by_sock, mosq);
mosq->sock = INVALID_SOCKET; mosq->sock = INVALID_SOCKET;
mosq->pollfd_index = -1; mosq->pollfd_index = -1;

Loading…
Cancel
Save