Skip to content

Commit

Permalink
Pass properties when disconnecting clients.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Nov 22, 2018
1 parent 47129e3 commit 236e967
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ set(C_SRC
connect.c
handle_auth.c
handle_connack.c
handle_disconnect.c
handle_ping.c
handle_pubackcomp.c
handle_publish.c
Expand Down
4 changes: 2 additions & 2 deletions lib/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ int mosquitto_disconnect_with_properties(struct mosquitto *mosq, int reason_code
}


void do_client_disconnect(struct mosquitto *mosq, int reason_code)
void do_client_disconnect(struct mosquitto *mosq, int reason_code, const mosquitto_property *properties)
{
pthread_mutex_lock(&mosq->state_mutex);
mosq->state = mosq_cs_disconnecting;
Expand Down Expand Up @@ -265,7 +265,7 @@ void do_client_disconnect(struct mosquitto *mosq, int reason_code)
}
if(mosq->on_disconnect_v5){
mosq->in_callback = true;
mosq->on_disconnect_v5(mosq, mosq->userdata, reason_code, NULL);
mosq->on_disconnect_v5(mosq, mosq->userdata, reason_code, properties);
mosq->in_callback = false;
}
pthread_mutex_unlock(&mosq->callback_mutex);
Expand Down
2 changes: 1 addition & 1 deletion lib/mosquitto_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ struct mosquitto {

#define STREMPTY(str) (str[0] == '\0')

void do_client_disconnect(struct mosquitto *mosq, int reason_code);
void do_client_disconnect(struct mosquitto *mosq, int reason_code, const mosquitto_property *properties);

#endif

2 changes: 1 addition & 1 deletion lib/packet_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ int packet__write(struct mosquitto *mosq)
}
pthread_mutex_unlock(&mosq->callback_mutex);
}else if(((packet->command)&0xF0) == CMD_DISCONNECT){
do_client_disconnect(mosq, MOSQ_ERR_SUCCESS);
do_client_disconnect(mosq, MOSQ_ERR_SUCCESS, NULL);
packet__cleanup(packet);
mosquitto__free(packet);
return MOSQ_ERR_SUCCESS;
Expand Down

0 comments on commit 236e967

Please sign in to comment.