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