Skip to content

Commit

Permalink
[MXCHIP] improver debug log for client connect info
Browse files Browse the repository at this point in the history
  • Loading branch information
mxchipwanges committed Mar 26, 2024
1 parent 870bb72 commit bee2776
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ nni_pipe_set_pid(nni_pipe *new_pipe, uint32_t id)
nni_mtx_unlock(&pipes_lk);
if (!p->cache || rv != 0) {
#ifdef CONFIG_MXCHIP
log_warn("*** kick old client %p hash %d", p, id);
log_warn("*** kick old client pipe(%p) client_id hash(%d)", p, id);
nano_pipe_event_disable(p->p_proto_data, true); // disable disconnect event if reconnect wes@240301
#endif
nni_pipe_close(p);
Expand Down
10 changes: 8 additions & 2 deletions src/sp/protocol/mqtt/nmq_mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ nano_pipe_start(void *arg)
nni_pipe *npipe = p->pipe;

bool is_sqlite = s->conf->sqlite.enable;
uint32_t clientid_key;

log_trace(" ########## nano_pipe_start ########## ");

Expand Down Expand Up @@ -679,13 +680,18 @@ nano_pipe_start(void *arg)
log_warn("IPv6 address is not supported in event msg yet");
}

log_debug("client connected! addr [%s port [%d]\n",
p->conn_param->ip_addr_v4, addr.s_in.sa_port);
// log_debug("client connected! addr [%s port [%d]\n",
// p->conn_param->ip_addr_v4, addr.s_in.sa_port);

session_keeping:
// Clientid should not be NULL since broker will assign one
// TODO use p_id
clientid = (char *) conn_param_get_clientid(p->conn_param);
clientid_key = DJBHashn(clientid, strlen(clientid));
log_debug("client_id(%s, hash %d), username(%s), passwd(%s), clean_start(%d), keepalive(%d) connected! addr [%s port [%d]\n",
clientid, clientid_key, p->conn_param->username.body, p->conn_param->password.body,
p->conn_param->clean_start, p->conn_param->keepalive_mqtt,
p->conn_param->ip_addr_v4, addr.s_in.sa_port);
if (!clientid) {
log_warn("NULL clientid found when try to restore session.");
nni_mtx_unlock(&s->lk);
Expand Down

0 comments on commit bee2776

Please sign in to comment.