philbowles/h4plugins

H4P_AsyncMQTT Reconnection bug.

Closed this issue · 0 comments

Hi

MQTT reconnection fails between router reboots. with time dependent factor.
MQTT broker is Mosquitto running as a service on Windows 10 connected to the same network

Test code :

#include<H4Plugins.h>
H4_USE_PLUGINS(115200,20,false) // Serial baud rate, Q size, SerialCmd autostop
H4P_SerialLogger h4sl;
H4P_WiFi h4wifi("ORANGE_1","123456789","eiffel");
H4P_AsyncMQTT h4mqtt("192.168.1.20",1883);

h4plugins : dev branch.
pangolin : master branch 0.0.7 : Enabled debugging.

A sample log :

09:34:09.162 -> H4 version 0.5.4
09:34:09.197 -> TYPE=1 wifi->h4: Device eiffel
09:34:09.197 -> TYPE=1 scmd->h4: svc start scmd
09:34:09.197 -> TYPE=2 svc->scmd: UP
09:34:09.232 -> H4P Version 0.5.7
09:34:09.232 -> TYPE=1 wifi->h4: svc start wifi
09:34:09.336 -> IP=192.168.1.25
09:34:09.336 -> TYPE=1 wifi->h4: IP=192.168.1.25
09:34:09.370 -> TYPE=2 svc->wifi: UP
09:34:09.370 -> TYPE=1 mqtt->h4: svc start mqtt
09:34:09.370 -> CONNECT FH=31544
09:34:09.438 -> ----> SEND CONNECT 40 bytes on wire
09:34:09.473 -> <---- FROM WIRE CONNACK 3FFF3D52 len=4
09:34:09.473 -> DUMP ALL 0 POOL BLOX
09:34:09.473 -> TXQ EMPTY
09:34:09.473 -> RXQ EMPTY
09:34:09.473 -> DUMP ALL 0 PACKETS OUTBOUND
09:34:09.473 -> DUMP ALL 0 PACKETS INBOUND
09:34:09.473 -> DUMP ALL 0 FRAGMENTS
09:34:09.473 ->
09:34:09.473 ->
09:34:09.473 -> SESSION IS CLEAN
09:34:09.473 -> CONNECTED FH=31824 SH=13864
09:34:09.473 -> Auto-subscribed to PANGO
09:34:09.473 -> ----> SEND SUBSCRIBE 12 bytes on wire
09:34:09.473 -> TYPE=2 svc->mqtt: UP
09:34:09.473 -> TYPE=1 mqtt->h4: MQTT CNX
09:34:09.473 -> ----> SEND SUBSCRIBE 15 bytes on wire
09:34:09.508 -> <---- FROM WIRE SUBACK 3FFF473A len=5
09:34:09.508 -> ----> SEND SUBSCRIBE 18 bytes on wire
09:34:09.508 -> <---- FROM WIRE SUBACK 3FFF473A len=5
09:34:09.508 -> ----> SEND SUBSCRIBE 18 bytes on wire
09:34:09.508 -> <---- FROM WIRE SUBACK 3FFF473A len=5
09:34:09.508 -> ----> SEND SUBSCRIBE 19 bytes on wire
09:34:09.508 -> <---- FROM WIRE SUBACK 3FFF473A len=5
09:34:09.508 -> ----> SEND PUBLISH 19 bytes on wire
09:34:09.508 -> <---- FROM WIRE SUBACK 3FFF473A len=5

<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>
09:34:36.900 -> ----> SEND PINGREQ 2 bytes on wire
09:34:44.957 -> T=35858 SRV GONE? ka=30 tix=46
09:34:44.957 -> DISCONNECT FH=30416 r=3
09:34:44.957 -> TYPE=4 svc->mqtt: DN
09:34:44.957 -> TYPE=1 mqtt->h4: MQTT DCX 3
09:34:48.352 -> TYPE=4 svc->wifi: DN
09:34:54.958 -> CONNECT FH=32352

09:34:56.379 -> TYPE=8 scmd->h4: h4/show/plugins
09:34:56.379 -> h4/svc/info/scmd UP ID=4
09:34:56.379 ->
09:34:56.379 -> h4/svc/info/slog UP ID=5
09:34:56.379 -> slog Filter 0xffffffff
09:34:56.379 ->
09:34:56.379 ->
09:34:56.379 -> h4/svc/info/wifi DN ID=6
09:34:56.379 -> Mode: STA
09:34:56.379 -> PHY mode: N
09:34:56.379 -> Channel: 13
09:34:56.379 -> AP id: 0
09:34:56.379 -> Status: 1
09:34:56.379 -> Auto connect: 1
09:34:56.379 -> SSID (8): ORANGE_1
09:34:56.379 -> Passphrase (9): 123456789
09:34:56.379 -> BSSID set: 0
09:34:56.379 -> Device eiffel Status: 6
09:34:56.379 ->
09:34:56.379 -> h4/svc/info/mqtt UP ID=7
09:34:56.414 -> Server: 192.168.1.20:1883 CNX
09:34:56.414 ->

<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>

09:35:20.849 -> Error starting mDNS
09:35:20.849 -> IP=192.168.1.26
09:35:20.849 -> TYPE=1 wifi->h4: IP=192.168.1.26
09:35:20.849 -> TYPE=2 svc->wifi: UP
=======================For diagnostic : h4/show/plugins command
09:35:22.196 -> TYPE=8 scmd->h4: h4/show/plugins
09:35:22.196 -> h4/svc/info/scmd UP ID=4
09:35:22.196 ->
09:35:22.196 -> h4/svc/info/slog UP ID=5
09:35:22.196 -> slog Filter 0xffffffff
09:35:22.196 ->
09:35:22.196 ->
09:35:22.196 -> h4/svc/info/wifi UP ID=6
09:35:22.231 -> Mode: STA
09:35:22.231 -> PHY mode: N
09:35:22.231 -> Channel: 11
09:35:22.231 -> AP id: 0
09:35:22.231 -> Status: 5
09:35:22.231 -> Auto connect: 1
09:35:22.231 -> SSID (8): ORANGE_1
09:35:22.231 -> Passphrase (9): 123456789
09:35:22.231 -> BSSID set: 0
09:35:22.231 -> Device eiffel Status: 3
09:35:22.231 ->
09:35:22.231 -> h4/svc/info/mqtt UP ID=7
09:35:22.231 -> Server: 192.168.1.20:1883 CNX
09:35:22.231 ->

<<<<<<<<<<<<<<<<<<<< Broker Connected to Router >>>>>>>>>>>>>>>>>>>>>>>>>>

09:35:58.656 -> TYPE=8 scmd->h4: h4/show/plugins
09:35:58.690 -> h4/svc/info/scmd UP ID=4
09:35:58.690 ->
09:35:58.690 -> h4/svc/info/slog UP ID=5
09:35:58.690 -> slog Filter 0xffffffff
09:35:58.690 ->
09:35:58.690 ->
09:35:58.690 -> h4/svc/info/wifi UP ID=6
09:35:58.690 -> Mode: STA
09:35:58.690 -> PHY mode: N
09:35:58.690 -> Channel: 11
09:35:58.690 -> AP id: 0
09:35:58.690 -> Status: 5
09:35:58.690 -> Auto connect: 1
09:35:58.690 -> SSID (8): ORANGE_1
09:35:58.690 -> Passphrase (9): 123456789
09:35:58.690 -> BSSID set: 0
09:35:58.690 -> Device eiffel Status: 3
09:35:58.690 ->
09:35:58.690 -> h4/svc/info/mqtt UP ID=7
09:35:58.690 -> Server: 192.168.1.20:1883 CNX <<<<<<<<<<< It's not.
09:35:58.690 ->

=======================For diagnostic : h4/show/q command

09:40:19.555 -> TYPE=8 scmd->h4: h4/show/q
09:40:19.589 -> Due @tick Type Min Max nRQ
09:40:19.589 -> 000370778 0003/0060 S 1000 0 298
09:40:19.589 -> 000375861 0003/0063 S 10000 0 33