Primitive v5 CONNACK support - no properties.

pull/1022/head
Roger A. Light 7 years ago
parent 561513fdd4
commit 4ee6941188

@ -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 {

@ -39,7 +39,12 @@ 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);
@ -47,6 +52,9 @@ int send__connack(struct mosquitto *context, int ack, int result)
}
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);
}

Loading…
Cancel
Save