Skip to content

Commit

Permalink
Fix some PUBLISH messages not being counted in $SYS stats.
Browse files Browse the repository at this point in the history
Closes #2448. Thanks to Antoine.
  • Loading branch information
ralight committed Aug 7, 2022
1 parent ba6bbd5 commit a913de2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions ChangeLog.txt
Expand Up @@ -15,6 +15,7 @@ Broker:
persistence. Closes #2546.
- Fix bridges not sending failure notification messages to the local broker if
the remote bridge connection fails. Closes #2467. Closes #1488.
- Fix some PUBLISH messages not being counted in $SYS stats. Closes #2448.

Client library:
- Fix threads library detection on Windows under cmake. Bumps the minimum
Expand Down
2 changes: 1 addition & 1 deletion lib/packet_mosq.c
Expand Up @@ -546,7 +546,7 @@ int packet__read(struct mosquitto *mosq)
mosq->in_packet.pos = 0;
#ifdef WITH_BROKER
G_MSGS_RECEIVED_INC(1);
if(((mosq->in_packet.command)&0xF5) == CMD_PUBLISH){
if(((mosq->in_packet.command)&0xF0) == CMD_PUBLISH){
G_PUB_MSGS_RECEIVED_INC(1);
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/websockets.c
Expand Up @@ -261,7 +261,7 @@ static int callback_mqtt(

#ifdef WITH_SYS_TREE
g_msgs_sent++;
if(((packet->command)&0xF6) == CMD_PUBLISH){
if(((packet->command)&0xF0) == CMD_PUBLISH){
g_pub_msgs_sent++;
}
#endif
Expand Down Expand Up @@ -356,7 +356,7 @@ static int callback_mqtt(

#ifdef WITH_SYS_TREE
G_MSGS_RECEIVED_INC(1);
if(((mosq->in_packet.command)&0xF5) == CMD_PUBLISH){
if(((mosq->in_packet.command)&0xF0) == CMD_PUBLISH){
G_PUB_MSGS_RECEIVED_INC(1);
}
#endif
Expand Down

0 comments on commit a913de2

Please sign in to comment.