Commit 173d935f authored by Dmitriy Zhuravlev's avatar Dmitriy Zhuravlev Committed by Kevin Kane

[IOT-2058] Close doubled secure session

Add checking whether secure session exists before creating new

Change-Id: Ia4c36f6257b01c1d81baf1082eba6d7fcd0e83f2
Signed-off-by: default avatarDmitriy Zhuravlev <d.zhuravlev@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19071Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarAndrii Shtompel <a.shtompel@samsung.com>
Reviewed-by: default avatarGreg Zaverucha <gregz@microsoft.com>
Reviewed-by: default avatarPhil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: default avatarKevin Kane <kkane@microsoft.com>
parent 982096ad
......@@ -2324,6 +2324,16 @@ CAResult_t CAinitiateSslHandshake(const CAEndpoint_t *endpoint)
CAResult_t res = CA_STATUS_OK;
OIC_LOG_V(DEBUG, NET_SSL_TAG, "In %s", __func__);
VERIFY_NON_NULL_RET(endpoint, NET_SSL_TAG, "Param endpoint is NULL" , CA_STATUS_INVALID_PARAM);
if (NULL != GetSslPeer(endpoint))
{
OIC_LOG(WARNING, NET_SSL_TAG, "Secure session exists and will be closed");
if (CA_STATUS_OK != CAcloseSslConnection(endpoint))
{
OIC_LOG(WARNING, NET_SSL_TAG, "Failed to close secure session");
}
}
oc_mutex_lock(g_sslContextMutex);
if (NULL == InitiateTlsHandshake(endpoint))
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment