[dtls] fix bug in resetting dtls state on error (#3653)

This commit is contained in:
Jonathan Hui
2019-03-07 09:12:56 -08:00
committed by GitHub
parent 2805ca463b
commit 5e4d07cb23
2 changed files with 5 additions and 2 deletions
+4 -2
View File
@@ -160,7 +160,7 @@ otError Dtls::Start(bool aClient,
// do not handle new connection before guard time expired
VerifyOrExit(mState == kStateStopped, rval = MBEDTLS_ERR_SSL_TIMEOUT);
mState = kStateConnecting;
mState = kStateInitializing;
mbedtls_ssl_init(&mSsl);
mbedtls_ssl_config_init(&mConf);
@@ -258,10 +258,12 @@ otError Dtls::Start(bool aClient,
}
#endif // OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE
mState = kStateConnecting;
Process();
exit:
if ((mState == kStateConnecting) && (rval != 0))
if ((mState == kStateInitializing) && (rval != 0))
{
mState = kStateStopped;
FreeMbedtls();
+1
View File
@@ -82,6 +82,7 @@ public:
enum State
{
kStateStopped = 0,
kStateInitializing,
kStateConnecting,
kStateConnected,
kStateCloseNotify,