mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-08-18 11:45:08 +08:00
Fix session expiry list corruption
This happens if a client with session-expiry-interval set disconnects, is kicked by a plugin, and then expires.
This commit is contained in:
@@ -67,6 +67,12 @@ int session_expiry__add(struct mosquitto *context)
|
||||
{
|
||||
struct session_expiry_list *item;
|
||||
|
||||
if(context->expiry_list_item){
|
||||
/* Already added, may happen in cases like a client disconnecting then
|
||||
* being kicked by a plugin. */
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
if(db.config->persistent_client_expiration == 0){
|
||||
if(context->session_expiry_interval == UINT32_MAX){
|
||||
/* There isn't a global expiry set, and the client has asked to
|
||||
@@ -92,6 +98,12 @@ int session_expiry__add_from_persistence(struct mosquitto *context, time_t expir
|
||||
{
|
||||
struct session_expiry_list *item;
|
||||
|
||||
if(context->expiry_list_item){
|
||||
/* Already added, may happen in cases like a client disconnecting then
|
||||
* being kicked by a plugin. */
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
if(db.config->persistent_client_expiration == 0){
|
||||
if(context->session_expiry_interval == UINT32_MAX){
|
||||
/* There isn't a global expiry set, and the client has asked to
|
||||
|
||||
Reference in New Issue
Block a user