Fork of Hello MQTT, using mbed TLS for secure mqtt transport
Fork of HelloMQTT by
Diff: MQTTSNetwork.h
- Revision:
- 22:4d0628d13870
- Parent:
- 21:4534812bb94f
--- a/MQTTSNetwork.h Fri Mar 17 08:42:29 2017 +0000 +++ b/MQTTSNetwork.h Sat Mar 18 01:54:50 2017 +0000 @@ -121,18 +121,13 @@ printf("mbedtls_ssl_read returned %d\r\n", ret); if (ret < 0) { if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) - { - // Some other error we can not recover from print_mbedtls_error("mbedtls_ssl_read", ret); - onError(tcpsocket, -1 ); - } - else { - // timeout occurred ... + else printf("Timed out? ...\r\n"); - _error = ret; - } + + _error = ret; printf("MQTTS client read returns with error!!!...\r\n"); - return -1; + return ret; } printf("MQTS client read successfully!! ...\r\n"); return ret ; @@ -149,12 +144,12 @@ if (ret < 0) { if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) { print_mbedtls_error("mbedtls_ssl_write", ret); - onError(tcpsocket, -1 ); + //onError(tcpsocket, -1 ); } else { _error = ret; } - return -1; + return ret; } return ret; @@ -172,7 +167,10 @@ // Save the hostname and port on first connect // Create the socket if (tcpsocket == NULL) + { + printf("Creating TCP socket ...\r\n"); tcpsocket = new TCPSocket(network); + } if (tcpsocket == NULL) ret = -1;