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.
This commit is contained in:
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,13 +202,13 @@ 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++){
|
||||
if(db.config->listeners[i].port == chunk.F.listener_port){
|
||||
context->listener = &db.config->listeners[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* 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++){
|
||||
if(db.config->listeners[i].port == chunk.F.listener_port){
|
||||
context->listener = &db.config->listeners[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -174,9 +174,9 @@ 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(context->listener){
|
||||
chunk.F.listener_port = context->listener->port;
|
||||
}
|
||||
|
||||
if(chunk.F.id_len == 0){
|
||||
|
Loading…
Reference in New Issue
Block a user