Return success on libwebsocket_write==0.

This commit is contained in:
Roger A. Light 2014-05-18 20:54:44 +01:00
parent 4bb7a45b71
commit 9ea161f90e
2 changed files with 4 additions and 1 deletions

View File

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

View File

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