|
|
|
@ -251,19 +251,19 @@ void context__send_will(struct mosquitto_db *db, struct mosquitto *ctxt)
|
|
|
|
|
|
|
|
|
|
void context__disconnect(struct mosquitto_db *db, struct mosquitto *context)
|
|
|
|
|
{
|
|
|
|
|
context->disconnect_t = time(NULL);
|
|
|
|
|
net__socket_close(db, context);
|
|
|
|
|
|
|
|
|
|
if(context->session_expiry_interval == 0){
|
|
|
|
|
context__send_will(db, context);
|
|
|
|
|
|
|
|
|
|
context->disconnect_t = time(NULL);
|
|
|
|
|
net__socket_close(db, context);
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(!context->bridge)
|
|
|
|
|
#endif
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(context->will_delay_interval == 0){
|
|
|
|
|
/* This will be done later, after the will is published */
|
|
|
|
|
/* This will be done later, after the will is published for delay>0. */
|
|
|
|
|
context__add_to_disused(db, context);
|
|
|
|
|
if(context->id){
|
|
|
|
|
context__remove_from_by_id(db, context);
|
|
|
|
@ -280,6 +280,10 @@ void context__disconnect(struct mosquitto_db *db, struct mosquitto *context)
|
|
|
|
|
|
|
|
|
|
void context__add_to_disused(struct mosquitto_db *db, struct mosquitto *context)
|
|
|
|
|
{
|
|
|
|
|
if(context->state == mosq_cs_disused) return;
|
|
|
|
|
|
|
|
|
|
context->state = mosq_cs_disused;
|
|
|
|
|
|
|
|
|
|
if(db->ll_for_free){
|
|
|
|
|
context->for_free_next = db->ll_for_free;
|
|
|
|
|
db->ll_for_free = context;
|
|
|
|
|