diff --git a/src/loop.c b/src/loop.c index 0828c40c..6f863728 100644 --- a/src/loop.c +++ b/src/loop.c @@ -525,6 +525,12 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol if(context->pollfd_index < 0){ continue; } +#ifdef WITH_WEBSOCKETS + if(context->wsi){ + // Websocket are already handled above + continue; + } +#endif #ifdef WITH_TLS if(pollfds[context->pollfd_index].revents & POLLIN || diff --git a/src/websockets.c b/src/websockets.c index 9923a287..dde0c9cc 100644 --- a/src/websockets.c +++ b/src/websockets.c @@ -593,7 +593,7 @@ static int callback_http(struct libwebsocket_context *context, case LWS_CALLBACK_DEL_POLL_FD: case LWS_CALLBACK_CHANGE_MODE_POLL_FD: HASH_FIND(hh_sock, db->contexts_by_sock, &pollargs->fd, sizeof(pollargs->fd), mosq); - if(mosq){ + if(mosq && (pollargs->events & POLLOUT)){ mosq->ws_want_write = true; } break;