Skip to content

Commit

Permalink
fix: segfault on out-of-shared-memory condition for multiplexed publi…
Browse files Browse the repository at this point in the history
…shers
  • Loading branch information
slact committed May 25, 2021
1 parent 37a4bde commit fb1155a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/store/memory/memstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -3027,16 +3027,18 @@ static ngx_int_t publish_multi_callback(ngx_int_t status, void *rptr, void *priv
pd->rc = status;
}

if(pd->ch.last_seen < ch->last_seen) {
pd->ch.last_seen = ch->last_seen;
}

if(pd->ch.messages < ch->messages) {
pd->ch.messages = ch->messages;
if(ch) {
if(pd->ch.last_seen < ch->last_seen) {
pd->ch.last_seen = ch->last_seen;
}

if(pd->ch.messages < ch->messages) {
pd->ch.messages = ch->messages;
}

pd->ch.subscribers += ch->subscribers;
}

pd->ch.subscribers += ch->subscribers;

pd->n--;

if(pd->n == 0) {
Expand Down

0 comments on commit fb1155a

Please sign in to comment.