Return success on libwebsocket_write==0.

pull/211/merge
Roger A. Light 12 years ago
parent 4bb7a45b71
commit 9ea161f90e

@ -74,7 +74,7 @@ int mosquitto_main_loop(struct mosquitto_db *db, int *listensock, int listensock
int rc; int rc;
#endif #endif
#ifdef WITH_WEBSOCKETS #ifdef WITH_WEBSOCKETS
struct libwebsocket_context *ws_context; struct libwebsocket_context *ws_context = NULL;
#endif #endif
#ifndef WIN32 #ifndef WIN32

@ -151,6 +151,9 @@ static int callback_mqtt(struct libwebsocket_context *context,
packet->pos += LWS_SEND_BUFFER_PRE_PADDING; packet->pos += LWS_SEND_BUFFER_PRE_PADDING;
} }
count = libwebsocket_write(wsi, &packet->payload[packet->pos], packet->to_process, LWS_WRITE_BINARY); count = libwebsocket_write(wsi, &packet->payload[packet->pos], packet->to_process, LWS_WRITE_BINARY);
if(count < 0){
return 0;
}
packet->to_process -= count; packet->to_process -= count;
packet->pos += count; packet->pos += count;
if(packet->to_process > 0){ if(packet->to_process > 0){

Loading…
Cancel
Save