Skip to content

Commit

Permalink
* FIX [nmq mqttv3] more support for mqttv3.
Browse files Browse the repository at this point in the history
  • Loading branch information
OdyWayne committed Jul 6, 2023
1 parent 331157b commit 97e1212
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sp/protocol/mqtt/mqtt_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,8 @@ conn_handler(uint8_t *packet, conn_param *cparam, size_t max)
cparam->will_retain = (cparam->con_flag & 0x20) >> 5;
log_trace("conn flag:%x", cparam->con_flag);
if ((cparam->will_flag == 1 && cparam->will_qos > 2) ||
(strncmp(cparam->pro_name.body, "MQTT", 4) != 0 &&
strncmp(cparam->pro_name.body, "MQIsdp", 6) != 0) ||
(strncmp(cparam->pro_name.body, MQTT_PROTOCOL_NAME, 4) != 0 &&
strncmp(cparam->pro_name.body, MQTT_PROTOCOL_NAME_v31, 6) != 0) ||

Check warning on line 592 in src/sp/protocol/mqtt/mqtt_parser.c

View check run for this annotation

Codecov / codecov/patch

src/sp/protocol/mqtt/mqtt_parser.c#L591-L592

Added lines #L591 - L592 were not covered by tests
cparam->pro_ver > 5 || cparam->pro_ver < 3)
return PROTOCOL_ERROR;
pos++;
Expand Down
2 changes: 2 additions & 0 deletions src/sp/transport/mqtt/broker_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ nmq_tcptran_pipe_send_cb(void *arg)
nmq_pipe_send_start_v4(p, msg, txaio);
else if (p->pro_ver == 5)
nmq_pipe_send_start_v5(p, msg, txaio);
else if (p->pro_ver == 3)
nmq_pipe_send_start_v4(p, msg, txaio);

Check warning on line 548 in src/sp/transport/mqtt/broker_tcp.c

View check run for this annotation

Codecov / codecov/patch

src/sp/transport/mqtt/broker_tcp.c#L547-L548

Added lines #L547 - L548 were not covered by tests
else {
log_error("msg with pro_ver that neither 4 nor 5 should not happened.");
nni_aio_finish_error(txaio, NNG_EPROTO);
Expand Down

0 comments on commit 97e1212

Please sign in to comment.