Commit 56ae1bcf authored by Dan Mihai's avatar Dan Mihai

IOT-2242 Port recent TCP adapter fix to Windows

Port change be6cd0c7 to Windows.

Unfortunately, Jenkins ignored the Windows build error for that change.

Change-Id: I059fa2d6b3bdd345f490239ea8a89612dbe8ceb9
Signed-off-by: default avatarDan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19855Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarDave Thaler <dthaler@microsoft.com>
Reviewed-by: default avatarWay Vadhanasin <wayvad@microsoft.com>
parent 80133516
......@@ -518,6 +518,8 @@ static void CASocketEventReturned(CASocketFd_t s, long networkEvents)
return;
}
assert(s != OC_INVALID_SOCKET);
if (FD_ACCEPT & networkEvents)
{
if ((caglobals.tcp.ipv4.fd != OC_INVALID_SOCKET) && (caglobals.tcp.ipv4.fd == s))
......@@ -532,7 +534,31 @@ static void CASocketEventReturned(CASocketFd_t s, long networkEvents)
if (FD_READ & networkEvents)
{
CAReceiveMessage(s);
oc_mutex_lock(g_mutexObjectList);
CATCPSessionInfo_t *session = NULL;
CATCPSessionInfo_t *tmp = NULL;
LL_FOREACH_SAFE(g_sessionList, session, tmp)
{
if (session && (session->fd == s))
{
CAResult_t res = CAReceiveMessage(session);
//disconnect session and clean-up data if any error occurs
if (res != CA_STATUS_OK)
{
#ifdef __WITH_TLS__
if (CA_STATUS_OK != CAcloseSslConnection(&session->sep.endpoint))
{
OIC_LOG(ERROR, TAG, "Failed to close TLS session");
}
#endif
LL_DELETE(g_sessionList, session);
CADisconnectTCPSession(session);
oc_mutex_unlock(g_mutexObjectList);
return;
}
}
}
oc_mutex_unlock(g_mutexObjectList);
}
}
......
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