Fix $SYS counters when message is sent over WS

Signed-off-by: Pierre Fersing <pierre.fersing@bleemeo.com>
This commit is contained in:
Pierre Fersing 2018-01-02 16:50:47 +01:00
parent a47c1a821b
commit 7df5c40004
2 changed files with 12 additions and 0 deletions

View File

@ -9,6 +9,8 @@ Broker:
- Fix 08-ssl-bridge.py test when using async dns lookups. Closes #507.
- Lines in the config file are no longer limited to 1024 characters long.
Closes #652.
- Fix $SYS counters of messages and bytes sent when message is sent over
a Websockets. Closes #250.
Client library:
- Fix incorrect PSK key being used if it had leading zeroes.

View File

@ -285,12 +285,22 @@ static int callback_mqtt(struct libwebsocket_context *context,
if(count < 0){
return 0;
}
#ifdef WITH_SYS_TREE
g_bytes_sent += count;
#endif
packet->to_process -= count;
packet->pos += count;
if(packet->to_process > 0){
break;
}
#ifdef WITH_SYS_TREE
g_msgs_sent++;
if(((packet->command)&0xF6) == PUBLISH){
g_pub_msgs_sent++;
}
#endif
/* Free data and reset values */
mosq->current_out_packet = mosq->out_packet;
if(mosq->out_packet){