Fix listener not being reassociated with client.

This occurred when reloading a persistence file and
`per_listener_settings true` is set and the client did not set a
username.

Closes #1891. Thanks to Mikkel Nepper-Christensen.
pull/1907/head
Roger A. Light 5 years ago
parent 4e13bdec04
commit e7a4e73cd8

@ -78,6 +78,9 @@ Broker:
- Add the `bridge_bind_address` option. Closes #1311.
- Fix crash on Windows if loading a plugin fails. Closes #1866.
- TLS certificates for the server are now reloaded on SIGHUP.
- Fix listener not being reassociated with client when reloading a persistence
file and `per_listener_settings true` is set and the client did not set a
username. Closes #1891.
Client library:
- Client no longer generates random client ids for v3.1.1 clients, these are

@ -202,6 +202,7 @@ static int persist__client_chunk_restore(FILE *db_fptr)
/* username is not freed here, it is now owned by context */
context->username = chunk.username;
chunk.username = NULL;
}
/* in per_listener_settings mode, try to find the listener by persisted port */
if(db.config->per_listener_settings && !context->listener && chunk.F.listener_port > 0){
for(i=0; i < db.config->listener_count; i++){
@ -211,7 +212,6 @@ static int persist__client_chunk_restore(FILE *db_fptr)
}
}
}
}
/* FIXME - we should expire clients here if they have exceeded their time */
}else{
rc = 1;

@ -174,10 +174,10 @@ static int persist__client_save(FILE *db_fptr)
if(context->username){
chunk.F.username_len = (uint16_t)strlen(context->username);
chunk.username = context->username;
}
if(context->listener){
chunk.F.listener_port = context->listener->port;
}
}
if(chunk.F.id_len == 0){
/* This should never happen, but in case we have a client with

Loading…
Cancel
Save