Skip to content

Commit

Permalink
Improve MQTT connect message
Browse files Browse the repository at this point in the history
Print error code if connection failed. Also make it clear that it's only TCP connection, not CONNECT response yet.

PUBLISHED_FROM=ab266a005d3765b2c77abcbce273d02ad5ddc077
  • Loading branch information
Deomid Ryabkov authored and cesantabot committed Oct 31, 2017
1 parent 78b578e commit 74e4753
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 3 deletions.
Binary file modified lib/cc3200/libmqtt.a
Binary file not shown.
Binary file modified lib/cc3220/libmqtt.a
Binary file not shown.
Binary file modified lib/esp32/libmqtt.a
Binary file not shown.
Binary file modified lib/esp8266/libmqtt.a
Binary file not shown.
7 changes: 4 additions & 3 deletions src/mgos_mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ static void mgos_mqtt_ev(struct mg_connection *nc, int ev, void *ev_data,

switch (ev) {
case MG_EV_CONNECT: {
bool success = (*(int *) ev_data == 0);
LOG(LL_INFO, ("MQTT Connect (%d)", success));
if (!success) break;
int status = *((int *) ev_data);
LOG(LL_INFO,
("MQTT TCP connect %s (%d)", (status == 0 ? "ok" : "error"), status));
if (status != 0) break;
struct mg_send_mqtt_handshake_opts opts;
memset(&opts, 0, sizeof(opts));
// char *cb_client_id = NULL, *cb_user = NULL, *cb_pass = NULL;
Expand Down

0 comments on commit 74e4753

Please sign in to comment.