Fix two issues with Websocket (#472)

* Websocket were always marked as "want_write" (even if they only
  want to read, or worse want nothing).
* Websocket FD was read twice in some case (when socket recv queue was
  larger that size read by libwebsocket)

Signed-off-by: Pierre Fersing <pierre.fersing@bleemeo.com>
pull/476/head
Pierre Fersing 8 years ago committed by Roger Light
parent 09cb1b61c8
commit 408972ddc1

@ -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 ||

@ -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;

Loading…
Cancel
Save