From: hyuna0213.jo Date: Thu, 8 Dec 2016 04:08:21 +0000 (+0900) Subject: [IOT-1575] Initialize socket fd after closing session X-Git-Tag: 1.3.0~1049^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2e5ca574b1ed63b8024807aef63abb1ae47868eb;p=platform%2Fupstream%2Fiotivity.git [IOT-1575] Initialize socket fd after closing session - add socket fd initialization after closing TCP session in tcpserver Change-Id: Icb40f0c37ccc17ee9972974cfeae752e3a60048d Signed-off-by: Minji Park Reviewed-on: https://gerrit.iotivity.org/gerrit/14499 Tested-by: jenkins-iotivity Reviewed-by: jihwan seo Reviewed-by: Uze Choi Reviewed-by: Ashok Babu Channa Signed-off-by: Jaehong Jo Signed-off-by: hyuna0213.jo Reviewed-on: https://gerrit.iotivity.org/gerrit/14777 Reviewed-by: Dan Mihai --- diff --git a/resource/csdk/connectivity/src/tcp_adapter/catcpserver.c b/resource/csdk/connectivity/src/tcp_adapter/catcpserver.c index 4d872a0..a25ea76 100644 --- a/resource/csdk/connectivity/src/tcp_adapter/catcpserver.c +++ b/resource/csdk/connectivity/src/tcp_adapter/catcpserver.c @@ -315,7 +315,10 @@ static void CASelectReturned(fd_set *readFds) if (FD_ISSET(svritem->fd, readFds)) { CAReceiveMessage(svritem->fd); - FD_CLR(svritem->fd, readFds); + if (-1 != svritem->fd) + { + FD_CLR(svritem->fd, readFds); + } } } } @@ -1395,6 +1398,8 @@ CAResult_t CADisconnectTCPSession(CATCPSessionInfo_t *svritem, size_t index) } OICFree(svritem); + svritem = NULL; + return CA_STATUS_OK; }