Fix bridge pollfd corruption on Windows.

Closes #2173. Thanks to Niclas Lindgren.
This commit is contained in:
Roger A. Light
2021-06-08 13:29:29 +01:00
parent 104b94db57
commit 238b68686a
2 changed files with 10 additions and 0 deletions
+2
View File
@@ -9,6 +9,8 @@ Broker:
Closes #2207.
- Improve QoS 0 outgoing packet queueing.
- Fix non-reachable bridge blocking the broker on Windows. Closes #2172.
- Fix possible corruption of pollfd array on Windows when bridges were
reconnecting. Closes #2173.
Clients:
- If sending mosquitto_sub output to a pipe, mosquitto_sub will now detect
+8
View File
@@ -245,6 +245,7 @@ int bridge__connect_step1(struct mosquitto *context)
rc = net__try_connect_step1(context, context->bridge->addresses[context->bridge->cur_address].address);
if(rc > 0 ){
if(rc == MOSQ_ERR_TLS){
mux__delete(context);
net__socket_close(context);
return rc; /* Error already printed */
}else if(rc == MOSQ_ERR_ERRNO){
@@ -270,6 +271,7 @@ int bridge__connect_step2(struct mosquitto *context)
rc = net__try_connect_step2(context, context->bridge->addresses[context->bridge->cur_address].port, &context->sock);
if(rc > 0){
if(rc == MOSQ_ERR_TLS){
mux__delete(context);
net__socket_close(context);
return rc; /* Error already printed */
}else if(rc == MOSQ_ERR_ERRNO){
@@ -298,6 +300,7 @@ int bridge__connect_step3(struct mosquitto *context)
rc = net__socket_connect_step3(context, context->bridge->addresses[context->bridge->cur_address].address);
if(rc > 0){
if(rc == MOSQ_ERR_TLS){
mux__delete(context);
net__socket_close(context);
return rc; /* Error already printed */
}else if(rc == MOSQ_ERR_ERRNO){
@@ -326,6 +329,7 @@ int bridge__connect_step3(struct mosquitto *context)
}else if(rc == MOSQ_ERR_EAI){
log__printf(NULL, MOSQ_LOG_ERR, "Error creating bridge: %s.", gai_strerror(errno));
}
mux__delete(context);
net__socket_close(context);
return rc;
}
@@ -437,6 +441,7 @@ int bridge__connect(struct mosquitto *context)
if(rc > 0){
if(rc == MOSQ_ERR_TLS){
mux__delete(context);
net__socket_close(context);
return rc; /* Error already printed */
}else if(rc == MOSQ_ERR_ERRNO){
@@ -466,6 +471,7 @@ int bridge__connect(struct mosquitto *context)
}else if(rc2 == MOSQ_ERR_EAI){
log__printf(NULL, MOSQ_LOG_ERR, "Error creating bridge: %s.", gai_strerror(errno));
}
mux__delete(context);
net__socket_close(context);
return rc2;
}
@@ -751,6 +757,7 @@ void bridge_check(void)
COMPAT_CLOSE(context->bridge->primary_retry_sock);
context->bridge->primary_retry_sock = INVALID_SOCKET;
context->bridge->primary_retry = 0;
mux__delete(context);
net__socket_close(context);
context->bridge->cur_address = 0;
}
@@ -761,6 +768,7 @@ void bridge_check(void)
COMPAT_CLOSE(context->bridge->primary_retry_sock);
context->bridge->primary_retry_sock = INVALID_SOCKET;
context->bridge->primary_retry = 0;
mux__delete(context);
net__socket_close(context);
context->bridge->cur_address = context->bridge->address_count-1;
}else{