add a handshake timeout, stop() should free the new clientCr and clientKey
This commit is contained in:
@@ -274,6 +274,10 @@ void WiFiSSLClient:: setPrivateKey(const char *private_key)
|
|||||||
_private_key = private_key;
|
_private_key = private_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WiFiSSLClient::setHandshakeTimeout(unsigned long handshake_timeout)
|
||||||
|
{
|
||||||
|
handshake_timeout = handshake_timeout * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
void WiFiSSLClient::flush()
|
void WiFiSSLClient::flush()
|
||||||
{
|
{
|
||||||
@@ -287,6 +291,8 @@ void WiFiSSLClient::stop()
|
|||||||
|
|
||||||
mbedtls_net_free(&_netContext);
|
mbedtls_net_free(&_netContext);
|
||||||
mbedtls_x509_crt_free(&_caCrt);
|
mbedtls_x509_crt_free(&_caCrt);
|
||||||
|
mbedtls_x509_crt_free(&_clientCrt);
|
||||||
|
mbedtls_pk_free(&_clientKey);
|
||||||
mbedtls_entropy_free(&_entropyContext);
|
mbedtls_entropy_free(&_entropyContext);
|
||||||
mbedtls_ssl_config_free(&_sslConfig);
|
mbedtls_ssl_config_free(&_sslConfig);
|
||||||
mbedtls_ctr_drbg_free(&_ctrDrbgContext);
|
mbedtls_ctr_drbg_free(&_ctrDrbgContext);
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public:
|
|||||||
virtual operator bool();
|
virtual operator bool();
|
||||||
virtual void setCertificate(const char *client_ca);
|
virtual void setCertificate(const char *client_ca);
|
||||||
virtual void setPrivateKey (const char *private_key);
|
virtual void setPrivateKey (const char *private_key);
|
||||||
|
virtual void setHandshakeTimeout(unsigned long handshake_timeout);
|
||||||
|
|
||||||
// using Print::write;
|
// using Print::write;
|
||||||
|
|
||||||
@@ -73,6 +74,7 @@ private:
|
|||||||
mbedtls_pk_context _clientKey;
|
mbedtls_pk_context _clientKey;
|
||||||
bool _connected;
|
bool _connected;
|
||||||
int _peek;
|
int _peek;
|
||||||
|
unsigned long handshake_timeout;
|
||||||
|
|
||||||
SemaphoreHandle_t _mbedMutex;
|
SemaphoreHandle_t _mbedMutex;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user