govorox / SSLClient

SSLClient - generic secure client Arduino library using mbedtls
GNU General Public License v3.0
78 stars 38 forks source link

`available()` return negative `res` and calls `stop()` with network connection #82

Closed Decezaris closed 1 month ago

Decezaris commented 1 month ago

First, thank you for the awesome job you guys working on!

My program is working 99% of the time but in some cases out of the blue I get a disconenction. Even with internet connection, the ssl connection just stops working and then I have to connect again. It is something that happens in fraction of seconds. Is there some reason to this happen?

Screenshot 2024-05-27 173252

Decezaris commented 1 month ago

I think that I fixed my issue, I was making the ssl config after initialize mqtt connection because my function to configure the ssl params is the same to connect and reconnect. When I called this same function before mqtt connection seems to be good, at least by now. I will wait for the next 24h and if it's OK, I'll close this issue.

Decezaris commented 1 month ago

Still happening... the ssl connection stops even with internet connection active 😞

I put a log inside the lib and who calls is the available() function

00:33:55:222 -> [1221602][D][SSLClient.cpp:459] available(): available function res: -30848

Full log bellow

00:33:55:222 -> [1221608][D][SSLClient.cpp:97] stop(): Stopping ssl client 00:33:55:222 -> [1221614][D][ssl__client.cpp:810] stop_ssl_socket(): Cleaning SSL connection. 00:33:55:222 -> [1221621][D][ssl__client.cpp:814] stop_ssl_socket(): Stopping SSL client. Current client pointer address: 0x3ffc2ba8 00:33:55:222 -> [1221638][D][ssl__client.cpp:819] stop_ssl_socket(): Freeing CA cert. Current ca_cert address: 0x3ffbcb74 00:33:55:222 -> [1221647][D][ssl__client.cpp:827] stop_ssl_socket(): Freeing client cert and client key. Current client_cert address: 0x3ffbcccc, client_key address: 0x3ffbce24

Decezaris commented 1 month ago

My MQTT client is closing the connection due to MQTT_KEEP_ALIVE_TIMEOUT so is not related to this library. Thanks!