Skip to content

Commit 74e4753

Browse files
Deomid Ryabkovcesantabot
authored andcommitted
Improve MQTT connect message
Print error code if connection failed. Also make it clear that it's only TCP connection, not CONNECT response yet. PUBLISHED_FROM=ab266a005d3765b2c77abcbce273d02ad5ddc077
1 parent 78b578e commit 74e4753

File tree

5 files changed

+4
-3
lines changed

5 files changed

+4
-3
lines changed

lib/cc3200/libmqtt.a

56 Bytes
Binary file not shown.

lib/cc3220/libmqtt.a

56 Bytes
Binary file not shown.

lib/esp32/libmqtt.a

96 Bytes
Binary file not shown.

lib/esp8266/libmqtt.a

84 Bytes
Binary file not shown.

src/mgos_mqtt.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ static void mgos_mqtt_ev(struct mg_connection *nc, int ev, void *ev_data,
116116

117117
switch (ev) {
118118
case MG_EV_CONNECT: {
119-
bool success = (*(int *) ev_data == 0);
120-
LOG(LL_INFO, ("MQTT Connect (%d)", success));
121-
if (!success) break;
119+
int status = *((int *) ev_data);
120+
LOG(LL_INFO,
121+
("MQTT TCP connect %s (%d)", (status == 0 ? "ok" : "error"), status));
122+
if (status != 0) break;
122123
struct mg_send_mqtt_handshake_opts opts;
123124
memset(&opts, 0, sizeof(opts));
124125
// char *cb_client_id = NULL, *cb_user = NULL, *cb_pass = NULL;

0 commit comments

Comments
 (0)