Unsubscribe-v5 test should use properties

pull/2345/merge
Roger A. Light 3 years ago
parent 99c49d3d39
commit ba665a3477

@ -13,7 +13,8 @@ connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5)
disconnect_packet = mosq_test.gen_disconnect(proto_ver=5)
mid = 1
unsubscribe_packet = mosq_test.gen_unsubscribe(mid, "unsubscribe/test", proto_ver=5)
props = mqtt5_props.gen_string_pair_prop(mqtt5_props.PROP_USER_PROPERTY, "key", "value")
unsubscribe_packet = mosq_test.gen_unsubscribe(mid, "unsubscribe/test", proto_ver=5, properties=props)
unsuback_packet = mosq_test.gen_unsuback(mid, proto_ver=5)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

@ -7,12 +7,18 @@ static int run = -1;
static void on_connect(struct mosquitto *mosq, void *obj, int rc)
{
int rc2;
mosquitto_property *proplist;
(void)obj;
if(rc){
exit(1);
}else{
mosquitto_unsubscribe(mosq, NULL, "unsubscribe/test");
rc2 = mosquitto_property_add_string_pair(&proplist, MQTT_PROP_USER_PROPERTY, "key", "value");
if(rc2 != MOSQ_ERR_SUCCESS){
abort();
}
mosquitto_unsubscribe_v5(mosq, NULL, "unsubscribe/test", proplist);
}
}

@ -737,10 +737,10 @@ def gen_unsubscribe(mid, topic, cmd=162, proto_ver=4, properties=b""):
else:
properties = mqtt5_props.prop_finalise(properties)
packet = struct.pack("!B", cmd)
l = 2+2+len(topic)+1+len(properties)
l = 2+2+len(topic)+len(properties)
packet += pack_remaining_length(l)
pack_format = "!HB"+str(len(properties))+"sH"+str(len(topic))+"s"
packet += struct.pack(pack_format, mid, len(properties), properties, len(topic), topic)
pack_format = "!H"+str(len(properties))+"sH"+str(len(topic))+"s"
packet += struct.pack(pack_format, mid, properties, len(topic), topic)
return packet
else:
pack_format = "!BBHH"+str(len(topic))+"s"

Loading…
Cancel
Save