[259] Fix crash when "lazy" type bridge attempts to reconnect.

Thanks to hakofugu41.

Bug: https://github.com/eclipse/mosquitto/issues/259
This commit is contained in:
Roger A. Light
2017-02-20 23:48:30 +00:00
parent 20197e2496
commit 6b68371dbe
2 changed files with 13 additions and 1 deletions
+3
View File
@@ -1,3 +1,6 @@
Broker:
- Fix crash when "lazy" type bridge attempts to reconnect. Closes #259.
1.4.10 - 20160816
=================
+10 -1
View File
@@ -246,7 +246,16 @@ int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int li
}else{
if(context->bridge->start_type == bst_lazy && context->bridge->lazy_reconnect){
rc = mqtt3_bridge_connect(db, context);
if(rc){
if(rc == MOSQ_ERR_SUCCESS){
pollfds[pollfd_index].fd = context->sock;
pollfds[pollfd_index].events = POLLIN;
pollfds[pollfd_index].revents = 0;
if(context->current_out_packet){
pollfds[pollfd_index].events |= POLLOUT;
}
context->pollfd_index = pollfd_index;
pollfd_index++;
}else{
context->bridge->cur_address++;
if(context->bridge->cur_address == context->bridge->address_count){
context->bridge->cur_address = 0;