Skip to content

Commit

Permalink
[MXCHIP] fix disconnect notify, [TODO]except pipe kicked out for dupl…
Browse files Browse the repository at this point in the history
…icated clientid with clean_start=1
  • Loading branch information
mxchipwanges committed Feb 29, 2024
1 parent 76257f9 commit 082f522
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/sp/protocol/mqtt/nmq_mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,11 @@ nano_pipe_start(void *arg)

nni_pipe_id_swap(npipe->p_id, old->pipe->p_id);
p->id = nni_pipe_id(npipe);
#ifndef CONFIG_MXCHIP // enable connect notify wes@240229
// set event to false so that no notification will be
// sent
p->event = false;
#endif
// set event of old pipe to false and discard it.
old->event = false;
old->pipe->cache = false;
Expand All @@ -707,7 +709,11 @@ nano_pipe_start(void *arg)
// clean previous session
old = nni_id_get(&s->cached_sessions, p->pipe->p_id);
if (old != NULL) {
#ifdef CONFIG_MXCHIP
old->event = false; // not notify if reconnected wes@240229
#else
old->event = true;
#endif
old->pipe->cache = false;
#ifdef NNG_SUPP_SQLITE
nni_qos_db_remove_by_pipe(
Expand Down Expand Up @@ -838,9 +844,7 @@ nano_pipe_close(void *arg)
nni_mtx_lock(&p->lk);
// set event to false avoid of sending the
// disconnecting msg
#ifdef CONFIG_MXCHIP
p->event = true; // force enable disconnect msg, by mxchip@20240222
#else
#ifndef CONFIG_MXCHIP // not disable disconnect notify wes@240229
p->event = false;
#endif
npipe->cache = true;
Expand Down Expand Up @@ -881,7 +885,7 @@ nano_pipe_close(void *arg)
// create disconnect event msg
#ifdef CONFIG_MXCHIP
send_disconnect_msg:
log_debug("-----> nano_msg_notify_disconnect(%s).", p->event ? "yes" : "no");
log_debug("---> nano_msg_notify_disconnect event %d, reason_code %d.", p->event, p->reason_code);
#endif
if (p->event) {
msg =
Expand Down

0 comments on commit 082f522

Please sign in to comment.