Skip to content

Commit

Permalink
* MDF [broker_mqtt] modify logging output
Browse files Browse the repository at this point in the history
Signed-off-by: jaylin <jaylin@emqx.io>
  • Loading branch information
JaylinYu committed Dec 25, 2024
1 parent b9ef005 commit a74c625
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/mqtt/protocol/mqtt/mqtt_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ mqtt_timer_cb(void *arg)
nni_pipe_send(p->pipe, &p->send_aio);
p->pingcnt ++;
nni_mtx_unlock(&s->mtx);
log_info("Send pingreq (sock%p)(%dms)", s, s->keepalive);
log_debug("Send pingreq (sock%p)(%dms)", s, s->keepalive);
nni_sleep_aio(s->retry, &p->time_aio);
return;
}
Expand Down
6 changes: 4 additions & 2 deletions src/sp/protocol/mqtt/mqtt_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ copyn_utf8_str(const uint8_t *src, uint32_t *pos, int *str_len, int limit)
return NULL;
}
} else {
log_warn("UTF-8 check failed!");
*str_len = -1;
}
}
Expand Down Expand Up @@ -1648,7 +1649,7 @@ int
nmq_subinfo_decode(nng_msg *msg, void *l, uint8_t ver)
{
char *topic;
uint8_t *payload_ptr, len_of_varint = 0, *var_ptr;
uint8_t *payload_ptr, len_of_varint = 0, *var_ptr;
uint32_t num = 0, len = 0, len_of_str = 0, subid = 0;
uint16_t len_of_topic = 0;
size_t bpos = 0, remain = 0;
Expand All @@ -1674,7 +1675,8 @@ nmq_subinfo_decode(nng_msg *msg, void *l, uint8_t ver)
return -2;
}

log_trace("prop len %d varint %d remain %d", len, len_of_varint, nni_msg_remaining_len(msg));
log_trace("prop len %d varint %d remain %d", len, len_of_varint,
nni_msg_remaining_len(msg));
payload_ptr = (uint8_t *) nni_msg_body(msg) + 2 + len + len_of_varint;

size_t pos = 2 + len_of_varint, target_pos = 2 + len_of_varint + len;
Expand Down
1 change: 1 addition & 0 deletions src/sp/protocol/mqtt/nmq_mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,7 @@ nano_pipe_recv_cb(void *arg)
// Store Subid RAP Topic for sub
nni_mtx_lock(&p->lk);
rv = nmq_subinfo_decode(msg, npipe->subinfol, cparam->pro_ver);
log_debug("Processing subinfo done");
if (rv < 0) {
log_error("Invalid subscribe packet!");
nni_msg_free(msg);
Expand Down
2 changes: 0 additions & 2 deletions src/sp/transport/mqtt/broker_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,6 @@ tcptran_pipe_recv_cb(void *arg)
if (nmq_unsubinfo_decode(msg, p->npipe->subinfol,
p->tcp_cparam->pro_ver) < 0) {
log_error("Invalid unsubscribe packet!");
// nni_msg_free(msg);
// conn_param_free(cparam);
rv = PROTOCOL_ERROR;
goto recv_error;
}
Expand Down
3 changes: 1 addition & 2 deletions src/sp/transport/mqtts/broker_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,12 +848,11 @@ tlstran_pipe_recv_cb(void *arg)
if (nmq_unsubinfo_decode(msg, p->npipe->subinfol,
p->tcp_cparam->pro_ver) < 0) {
log_error("Invalid unsubscribe packet!");
// nni_msg_free(msg);
// conn_param_free(cparam);
rv = PROTOCOL_ERROR;
goto recv_error;
}
}

if (ack == true) {
// alloc a msg here costs memory. However we must do it for the
// sake of compatibility with nng.
Expand Down

0 comments on commit a74c625

Please sign in to comment.