]> granicus.if.org Git - esp-idf/commitdiff
esp-tls: Log errors for all "connection failed" code paths
authorAngus Gratton <angus@espressif.com>
Thu, 19 Apr 2018 01:34:27 +0000 (11:34 +1000)
committerAngus Gratton <gus@projectgus.com>
Thu, 19 Apr 2018 01:34:27 +0000 (11:34 +1000)
components/esp-tls/esp_tls.c

index 73130a64df424fd73a6ae0ee762835e5c098c0d1..941cb684815bcaf9dc592270328adada4a779827 100644 (file)
@@ -83,6 +83,7 @@ static int esp_tcp_connect(const char *host, int hostlen, int port)
 
     int ret = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
     if (ret < 0) {
+        ESP_LOGE(TAG, "Failed to create socket (family %d socktype %d protocol %d)", res->ai_family, res->ai_socktype, res->ai_protocol);
         goto err_freeaddr;
     }
     int fd = ret;
@@ -98,12 +99,13 @@ static int esp_tcp_connect(const char *host, int hostlen, int port)
         p->sin6_family = AF_INET6;
         addr_ptr = p;
     } else {
-       /* Unsupported Protocol Family */
+        ESP_LOGE(TAG, "Unsupported protocol family %d", res->ai_family);
         goto err_freesocket;
     }
 
     ret = connect(fd, addr_ptr, res->ai_addrlen);
     if (ret < 0) {
+        ESP_LOGE(TAG, "Failed to connnect to host (errno %d)", errno);
         goto err_freesocket;
     }