Skip to content

mqtt status: name the TLS handshake state - #1

Merged
schikani merged 1 commit into
tinydesk-project:mainfrom
TharunBabu-05:fix/mqtt-status-tls-handshake
Oct 4, 2026
Merged

schikani merged 1 commit into
tinydesk-project:mainfrom
TharunBabu-05:fix/mqtt-status-tls-handshake

Conversation

@TharunBabu-05

Copy link
Copy Markdown
Contributor

What changed for users

mqtt status printed MQTT: not connected while a TLS connection was being
set up, directly above the status text TLS handshake with <broker>....
It now prints MQTT: TLS handshake.

It shows when the connection was started from the MQTT app, or by
mqtt connect -r while it retries (every retry goes through the handshake
again).

The change

state_name() in ports/common/td_proto_cmds.c had no case for
TD_MQTT_TLS_HANDSHAKE, so it fell through to default. The switch now lists
every td_mqtt_state_t value and has no default, so -Wswitch (part of
-Wall; the builds use -Werror) reports a state added later. No API change.

Tested

  • Host build on Windows (MinGW GCC 15.2), with and without MQTT over TLS
    (mbedTLS v3.6.7, as in CI): no warnings, all 7 CTest programs pass.
  • tdsim against a local TCP listener that accepts and never answers, so the
    client stays in the handshake: mqtt connect -r mqtts://127.0.0.1:18883,
    then mqtt status after the first retry.
    • before: MQTT: not connected
    • after: MQTT: TLS handshake
  • mqtt status with no connection still prints MQTT: not connected. The CI
    smoke tests (echo through the shell; mqtts reaches "Connecting to") pass.
  • With one case removed, the build fails with
    enumeration value 'TD_MQTT_TLS_HANDSHAKE' not handled in switch.
  • Not built here: the ESP32 firmware (no ESP-IDF on this machine). The file
    is plain C; CI builds all three boards.

While a TLS connection was being set up (or -r retried one), `mqtt status`
printed "MQTT: not connected" above "TLS handshake with ...". state_name()
now lists every state without a default, so -Wswitch catches a new one.
Copilot AI balanced review requested due to automatic review settings October 3, 2026 17:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@schikani
schikani merged commit e49ae21 into tinydesk-project:main Oct 4, 2026
6 checks passed
@schikani

schikani commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator

Thanks, real bug and a clean fix. Builds and tests pass here on MinGW too. Merging.

@TharunBabu-05
TharunBabu-05 deleted the fix/mqtt-status-tls-handshake branch October 5, 2026 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants