Skip to content

Commit

Permalink
Primitive v5 CONNACK support - no properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Sep 19, 2018
1 parent 561513f commit 4ee6941
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/mosquitto_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ enum mosquitto__protocol {
mosq_p_mqtt31 = 1,
mosq_p_mqtt311 = 2,
mosq_p_mqtts = 3,
mosq_p_mqtt5 = 4,
mosq_p_mqtt5 = 5,
};

enum mosquitto__threaded_state {
Expand Down
10 changes: 9 additions & 1 deletion src/send_connack.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,22 @@ int send__connack(struct mosquitto *context, int ack, int result)
if(!packet) return MOSQ_ERR_NOMEM;

packet->command = CONNACK;
packet->remaining_length = 2;
if(context->protocol == mosq_p_mqtt5){
/* FIXME - proper property support */
packet->remaining_length = 3;
}else{
packet->remaining_length = 2;
}
rc = packet__alloc(packet);
if(rc){
mosquitto__free(packet);
return rc;
}
packet->payload[packet->pos+0] = ack;
packet->payload[packet->pos+1] = result;
if(context->protocol == mosq_p_mqtt5){
packet->payload[packet->pos+2] = 0;
}

return packet__queue(context, packet);
}
Expand Down

0 comments on commit 4ee6941

Please sign in to comment.