mirror of
https://github.com/espressif/openthread.git
synced 2026-08-20 01:19:51 +00:00
[dtls] do not free mbedtls context if one is already being used (#3628)
This commit is contained in:
@@ -160,6 +160,8 @@ otError Dtls::Start(bool aClient,
|
||||
// do not handle new connection before guard time expired
|
||||
VerifyOrExit(mState == kStateStopped, rval = MBEDTLS_ERR_SSL_TIMEOUT);
|
||||
|
||||
mState = kStateConnecting;
|
||||
|
||||
mbedtls_ssl_init(&mSsl);
|
||||
mbedtls_ssl_config_init(&mConf);
|
||||
mbedtls_ctr_drbg_init(&mCtrDrbg);
|
||||
@@ -244,7 +246,6 @@ otError Dtls::Start(bool aClient,
|
||||
mContext = aContext;
|
||||
mReceiveMessage = NULL;
|
||||
mMessageSubType = Message::kSubTypeNone;
|
||||
mState = kStateConnecting;
|
||||
|
||||
if (mCipherSuites[0] == MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8)
|
||||
{
|
||||
@@ -260,8 +261,9 @@ otError Dtls::Start(bool aClient,
|
||||
Process();
|
||||
|
||||
exit:
|
||||
if (rval != 0)
|
||||
if ((mState == kStateConnecting) && (rval != 0))
|
||||
{
|
||||
mState = kStateStopped;
|
||||
FreeMbedtls();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user