mirror of
https://github.com/eclipse/mosquitto.git
synced 2025-05-09 17:21:09 +08:00
Add clients to session expiry check list when restarting and reloading from persistence.
Closes #2546. Thanks to Joachim Schachermayer.
This commit is contained in:
parent
80b36919b1
commit
c99502a256
@ -11,6 +11,8 @@ Broker:
|
|||||||
required for MQTT v3.1. Closes #2522.
|
required for MQTT v3.1. Closes #2522.
|
||||||
- Improve documentation of `persistent_client_expiration` option.
|
- Improve documentation of `persistent_client_expiration` option.
|
||||||
Closes #2404.
|
Closes #2404.
|
||||||
|
- Add clients to session expiry check list when restarting and reloading from
|
||||||
|
persistence. Closes #2546.
|
||||||
|
|
||||||
Client library:
|
Client library:
|
||||||
- Fix threads library detection on Windows under cmake. Bumps the minimum
|
- Fix threads library detection on Windows under cmake. Bumps the minimum
|
||||||
|
@ -818,6 +818,7 @@ void unpwd__free_item(struct mosquitto__unpwd **unpwd, struct mosquitto__unpwd *
|
|||||||
* Session expiry
|
* Session expiry
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
int session_expiry__add(struct mosquitto *context);
|
int session_expiry__add(struct mosquitto *context);
|
||||||
|
int session_expiry__add_from_persistence(struct mosquitto *context, time_t expiry_time);
|
||||||
void session_expiry__remove(struct mosquitto *context);
|
void session_expiry__remove(struct mosquitto *context);
|
||||||
void session_expiry__remove_all(void);
|
void session_expiry__remove_all(void);
|
||||||
void session_expiry__check(void);
|
void session_expiry__check(void);
|
||||||
|
@ -208,7 +208,7 @@ static int persist__client_chunk_restore(FILE *db_fptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* FIXME - we should expire clients here if they have exceeded their time */
|
session_expiry__add_from_persistence(context, chunk.F.session_expiry_time);
|
||||||
}else{
|
}else{
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,23 @@ int session_expiry__add(struct mosquitto *context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int session_expiry__add_from_persistence(struct mosquitto *context, time_t expiry_time)
|
||||||
|
{
|
||||||
|
struct session_expiry_list *item;
|
||||||
|
|
||||||
|
item = mosquitto__calloc(1, sizeof(struct session_expiry_list));
|
||||||
|
if(!item) return MOSQ_ERR_NOMEM;
|
||||||
|
|
||||||
|
item->context = context;
|
||||||
|
item->context->session_expiry_time = expiry_time;
|
||||||
|
context->expiry_list_item = item;
|
||||||
|
|
||||||
|
DL_INSERT_INORDER(expiry_list, item, session_expiry__cmp);
|
||||||
|
|
||||||
|
return MOSQ_ERR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void session_expiry__remove(struct mosquitto *context)
|
void session_expiry__remove(struct mosquitto *context)
|
||||||
{
|
{
|
||||||
if(context->expiry_list_item){
|
if(context->expiry_list_item){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user