Only a single call to lws_write() is required.

pull/2215/head
Roger A. Light 4 years ago
parent 880df7360d
commit 4a08626f43

@ -125,7 +125,6 @@ static int callback_mqtt(
{ {
struct mosquitto *mosq = NULL; struct mosquitto *mosq = NULL;
struct mosquitto__packet *packet; struct mosquitto__packet *packet;
size_t txlen;
int count; int count;
unsigned int ucount; unsigned int ucount;
const struct lws_protocols *p; const struct lws_protocols *p;
@ -233,12 +232,7 @@ static int callback_mqtt(
memmove(&packet->payload[LWS_PRE], packet->payload, packet->packet_length); memmove(&packet->payload[LWS_PRE], packet->payload, packet->packet_length);
packet->pos += LWS_PRE; packet->pos += LWS_PRE;
} }
if(packet->to_process > WS_TX_BUF_SIZE){ count = lws_write(wsi, &packet->payload[packet->pos], packet->to_process, LWS_WRITE_BINARY);
txlen = WS_TX_BUF_SIZE;
}else{
txlen = packet->to_process;
}
count = lws_write(wsi, &packet->payload[packet->pos], txlen, LWS_WRITE_BINARY);
if(count < 0){ if(count < 0){
if (mosq->state == mosq_cs_disconnect_ws if (mosq->state == mosq_cs_disconnect_ws
|| mosq->state == mosq_cs_disconnecting || mosq->state == mosq_cs_disconnecting

Loading…
Cancel
Save