reconnecting a lwip socket / SSL handshake problem
Posted: Fri Jan 27, 2017 9:39 am
Hi all,
I'm sending a message over a ssl connection, after completing and closing the connection I am attempting to create another connection and that's where I'm getting a lwip_bind failed:
Error -8 is defined as: Address already in use. so I googled around and set CONFIG_LWIP_SO_REUSE but it seems that does not help.
If the lwip_bind doesn't return a failure or when I restart the device the ssl connection succeeds or gets stuck in a handshake state TLS_ST_SR_KEY_EXCH 28 or TLS_ST_CW_KEY_EXCH 14.
I'm having a hard time finding out what those states mean, besides the obvious that they flag a failed key exchange of some sort.
The OSSL_HANDSHAKE_STATE doesn't provide me with a hint on what to do next.
After completing the ssl connection on success or failure I shutdown the ssl connection like this:
I'm sending a message over a ssl connection, after completing and closing the connection I am attempting to create another connection and that's where I'm getting a lwip_bind failed:
Code: Select all
lwip_socket(PF_INET, SOCK_STREAM, 0) = 1
lwip_bind(1, addr=0.0.0.0 port=8883)
lwip_bind(1) failed, err=-8
E (1121912) SSLClient: LWIP Bind Failed: 0xffffffff, socket: 1
lwip_close: (1)
lwip_close: is_tcp=1
If the lwip_bind doesn't return a failure or when I restart the device the ssl connection succeeds or gets stuck in a handshake state TLS_ST_SR_KEY_EXCH 28 or TLS_ST_CW_KEY_EXCH 14.
I'm having a hard time finding out what those states mean, besides the obvious that they flag a failed key exchange of some sort.
The OSSL_HANDSHAKE_STATE doesn't provide me with a hint on what to do next.
After completing the ssl connection on success or failure I shutdown the ssl connection like this:
Code: Select all
SSL_shutdown(_ssl);
SSL_free(_ssl);
_ssl = 0;
close(socket);
socket = -1;
SSL_CTX_free(_ssl_ctx);
_ssl_ctx = 0;