Fix dynamic bridge start-up delay

Signed-off-by: Chris Elston <chris.elston@sancloud.com>

The first packet sent by a dynamic bridge was failing because it was
sent before the socket was fully established and the OS returned
-EAGAIN. We had to wait for the next PINGREQ to cause the initial packet
to be sent, and therefore bridge startup was delayed by the
configured keepalive timeout (default 60 seconds).

This change adds the new bridge's output socket to the list managed by
the mux, and we now send the initial CONNECT as soon as the output
socket becomes available.
pull/2318/head
Chris Elston 4 years ago
parent 2b866904aa
commit cd3b588601

@ -74,6 +74,7 @@ int bridge__dynamic_analyse(struct mosquitto_db *db, char *topic, void* payload,
log__printf(NULL, MOSQ_LOG_WARNING, "Information : Start connection with bridge %s.",
config.bridges[config.bridge_count-1].name);
mux__add_in(db->bridges[db->bridge_count-1]);
mux__add_out(db->bridges[db->bridge_count-1]);
}
}else if(strncmp("$BRIDGE/del", topic, 11)==0){
rc = bridge__dynamic_parse_payload_del_json(payload,db,index);

Loading…
Cancel
Save