Fixed an regression that MQTT client timer is disarmed prematurely when
connecting to server. Inside af426d03, the `mqtt_socket_timer` function was modified so that instead of checking the presense of allocated `mud->pesp_conn` structure, `mud->connected` field was used on determining if the timer need to be disarmed. However, this is not entirely correct. If the TCP socket is actively connecting and haven't timed out yet, then `mud->connected` is also `false` and the timer will think the connection is broken and disarms itself. This has two consequences: * The connection timeout counter is no longer decremented and checked * After connection succeeds, keepalive heartbeat is no longer being sent (#3166). This is particularly noticeable in MQTT over TLS connections, because those usually takes longer than 1 second to finish and the timer would had chance to execute before connection is established This commit checks the presense of `pesp_conn->proto.tcp` pointer instead, which was allocated in the same place as the (old) `pesp_conn` struct, and according to my test indeed fixes the above issue.
Please register or sign in to comment