Skip to content

Commit

Permalink
[MXCHIP] disable disconnect event if kicked out by reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
mxchipwanges committed Mar 1, 2024
1 parent 1b9d0d8 commit f12f9d3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ nni_pipe_id_swap(uint32_t old_id, uint32_t new_id)
}
}

#ifdef CONFIG_MXCHIP
extern void nano_pipe_event_disable(void *p_nano_pipe, bool flag);
#endif

/**
* replace pid with input uint32 value
* return 0 : successed
Expand All @@ -502,6 +506,7 @@ nni_pipe_set_pid(nni_pipe *new_pipe, uint32_t id)
{
int rv;
nni_pipe *p;

// remove the id set by NNG
nni_mtx_lock(&pipes_lk);
nni_id_remove(&pipes, new_pipe->p_id);
Expand All @@ -512,6 +517,10 @@ nni_pipe_set_pid(nni_pipe *new_pipe, uint32_t id)
rv = nni_id_set(&pipes, id, new_pipe);
nni_mtx_unlock(&pipes_lk);
if (!p->cache || rv != 0) {
#ifdef CONFIG_MXCHIP
log_warn("*** kick old client %p 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);
}
return rv;
Expand Down
12 changes: 12 additions & 0 deletions src/sp/protocol/mqtt/nmq_mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,18 @@ nano_pipe_fini(void *arg)
nano_nni_lmq_fini(&p->rlmq);
}

#ifdef CONFIG_MXCHIP
void nano_pipe_event_disable(void *p_nano_pipe, bool flag)
{
nano_pipe *p = p_nano_pipe;

log_debug("*** nano_pipe_event_disable(%d), nni_pipe %p", flag, p->pipe);
if(p != NULL){
p->event = !flag;
}
}
#endif

static int
nano_pipe_init(void *arg, nni_pipe *pipe, void *s)
{
Expand Down

0 comments on commit f12f9d3

Please sign in to comment.