Be consistent about removing listener counts on socket close.

pull/211/merge
Roger A. Light 11 years ago
parent 7cef936ba6
commit 4430228855

@ -215,6 +215,14 @@ int _mosquitto_socket_close(struct mosquitto *mosq)
mosq->sock = INVALID_SOCKET;
}
#ifdef WITH_BROKER
if(mosq->listener){
mosq->listener->client_count--;
assert(mosq->listener->client_count >= 0);
mosq->listener = NULL;
}
#endif
return rc;
}

@ -118,12 +118,7 @@ void mqtt3_context_cleanup(struct mosquitto_db *db, struct mosquitto *context, b
}
#endif
if(context->sock != -1){
if(context->listener){
context->listener->client_count--;
assert(context->listener->client_count >= 0);
}
_mosquitto_socket_close(context);
context->listener = NULL;
}
if(context->clean_session && db){
mqtt3_subs_clean_session(db, context, &db->subs);
@ -192,11 +187,6 @@ void mqtt3_context_disconnect(struct mosquitto_db *db, struct mosquitto *ctxt)
_mosquitto_free(ctxt->will);
ctxt->will = NULL;
}
if(ctxt->listener){
ctxt->listener->client_count--;
assert(ctxt->listener->client_count >= 0);
ctxt->listener = NULL;
}
ctxt->disconnect_t = mosquitto_time();
#ifdef WITH_SYS_TREE
db->connected_count--;

Loading…
Cancel
Save