Skip to content

Commit

Permalink
Read reason code for PUBREC/PUBREL.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Dec 23, 2018
1 parent c1baf21 commit 659cd2a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/handle_pubackcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ int handle__pubackcomp(struct mosquitto_db *db, struct mosquitto *mosq, const ch
int handle__pubackcomp(struct mosquitto *mosq, const char *type)
#endif
{
uint8_t reason_code;
uint16_t mid;
int rc;
mosquitto_property *properties = NULL;
Expand All @@ -52,6 +53,9 @@ int handle__pubackcomp(struct mosquitto *mosq, const char *type)
if(mid == 0) return MOSQ_ERR_PROTOCOL;

if(mosq->protocol == mosq_p_mqtt5){
rc = packet__read_byte(&mosq->in_packet, &reason_code);
if(rc) return rc;

rc = property__read_all(CMD_PUBACK, &mosq->in_packet, &properties);
if(rc) return rc;
}
Expand Down
4 changes: 4 additions & 0 deletions lib/handle_pubrec.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ and the Eclipse Distribution License is available at

int handle__pubrec(struct mosquitto *mosq)
{
uint8_t reason_code;
uint16_t mid;
int rc;
mosquitto_property *properties = NULL;
Expand All @@ -47,6 +48,9 @@ int handle__pubrec(struct mosquitto *mosq)
if(mid == 0) return MOSQ_ERR_PROTOCOL;

if(mosq->protocol == mosq_p_mqtt5){
rc = packet__read_byte(&mosq->in_packet, &reason_code);
if(rc) return rc;

rc = property__read_all(CMD_PUBREC, &mosq->in_packet, &properties);
if(rc) return rc;
/* Immediately free, we don't do anything with Reason String or User Property at the moment */
Expand Down
4 changes: 4 additions & 0 deletions lib/handle_pubrel.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ and the Eclipse Distribution License is available at

int handle__pubrel(struct mosquitto_db *db, struct mosquitto *mosq)
{
uint8_t reason_code;
uint16_t mid;
#ifndef WITH_BROKER
struct mosquitto_message_all *message = NULL;
Expand All @@ -56,6 +57,9 @@ int handle__pubrel(struct mosquitto_db *db, struct mosquitto *mosq)
if(mid == 0) return MOSQ_ERR_PROTOCOL;

if(mosq->protocol == mosq_p_mqtt5){
rc = packet__read_byte(&mosq->in_packet, &reason_code);
if(rc) return rc;

rc = property__read_all(CMD_PUBREL, &mosq->in_packet, &properties);
if(rc) return rc;
}
Expand Down

0 comments on commit 659cd2a

Please sign in to comment.