Closed jbaudoux closed 6 months ago
Thanks!
I just tried it with my setup here, and if the broker is not reachable, I get this:
00:58:49.481 > Will topic: BSB-LAN/status
00:58:49.496 > [ 38299][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.504 > Failed to connect to MQTT broker, retrying...
00:58:49.507 > Client ID: BSB-LAN
00:58:49.510 > Will topic: BSB-LAN/status
00:58:49.537 > [ 38340][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.545 > Failed to connect to MQTT broker, retrying...
00:58:49.548 > Client ID: BSB-LAN
00:58:49.551 > Will topic: BSB-LAN/status
00:58:49.568 > [ 38372][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.576 > Failed to connect to MQTT broker, retrying...
00:58:49.579 > Client ID: BSB-LAN
00:58:49.582 > Will topic: BSB-LAN/status
00:58:49.598 > [ 38402][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.606 > Failed to connect to MQTT broker, retrying...
00:58:49.609 > Client ID: BSB-LAN
00:58:49.612 > Will topic: BSB-LAN/status
00:58:49.628 > [ 38431][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.636 > Failed to connect to MQTT broker, retrying...
00:58:49.639 > Client ID: BSB-LAN
00:58:49.641 > Will topic: BSB-LAN/status
00:58:49.661 > [ 38464][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.669 > Failed to connect to MQTT broker, retrying...
00:58:49.672 > Client ID: BSB-LAN
00:58:49.674 > Will topic: BSB-LAN/status
00:58:49.690 > [ 38493][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.698 > Failed to connect to MQTT broker, retrying...
00:58:49.701 > Client ID: BSB-LAN
00:58:49.704 > Will topic: BSB-LAN/status
00:58:49.717 > [ 38520][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.725 > Failed to connect to MQTT broker, retrying...
00:58:49.728 > Client ID: BSB-LAN
00:58:49.730 > Will topic: BSB-LAN/status
00:58:49.752 > [ 38555][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.760 > Failed to connect to MQTT broker, retrying...
00:58:49.763 > Client ID: BSB-LAN
00:58:49.766 > Will topic: BSB-LAN/status
00:58:49.777 > [ 38580][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.785 > Failed to connect to MQTT broker, retrying...
00:58:49.788 > Client ID: BSB-LAN
00:58:49.790 > Will topic: BSB-LAN/status
00:58:49.803 > [ 38606][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.811 > Failed to connect to MQTT broker, retrying...
00:58:49.814 > Client ID: BSB-LAN
00:58:49.816 > Will topic: BSB-LAN/status
00:58:49.830 > [ 38633][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.838 > Failed to connect to MQTT broker, retrying...
00:58:49.841 > Client ID: BSB-LAN
00:58:49.844 > Will topic: BSB-LAN/status
00:58:49.862 > [ 38666][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.871 > Failed to connect to MQTT broker, retrying...
00:58:49.873 > Client ID: BSB-LAN
00:58:49.876 > Will topic: BSB-LAN/status
00:58:49.889 > [ 38693][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.897 > Failed to connect to MQTT broker, retrying...
00:58:49.900 > Client ID: BSB-LAN
00:58:49.903 > Will topic: BSB-LAN/status
00:58:49.918 > [ 38721][E][WiFiClient.cpp:275] connect(): socket error on fd 50, errno: 104, "Connection reset by peer"
00:58:49.926 > Failed to connect to MQTT broker, retrying...
00:58:49.929 > Client ID: BSB-LAN
So it's constantly trying to reconnect. Any idea why this is the case?
Ok, after half an hour testing and searching I realized that you forgot to set mqtt_reconnect_timer
to the actual value if the connection fails (e.g. due to an unavailable broker). I wonder how this could not have occurred during your testings :(...
Relates to https://github.com/fredlcore/BSB-LAN/issues/638
Before
Hanging for 3 * 1s
After