Skip to content

Commit

Permalink
Only remove context from hash if there is a client id.
Browse files Browse the repository at this point in the history
This should never happen, but just in case.
  • Loading branch information
ralight committed Nov 6, 2018
1 parent 7f1419e commit 93f9e96
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,11 @@ void do_disconnect(struct mosquitto_db *db, struct mosquitto *context)
context->sock = INVALID_SOCKET;
context->pollfd_index = -1;
}
HASH_DELETE(hh_id, db->contexts_by_id, context);
context->old_id = context->id;
context->id = NULL;
if(context->id){
HASH_DELETE(hh_id, db->contexts_by_id, context);
context->old_id = context->id;
context->id = NULL;
}
}else
#endif
{
Expand Down

0 comments on commit 93f9e96

Please sign in to comment.