Update snapshot(2017-11-02) 63/158763/1 accepted/tizen/4.0/unified/20171106.074049 submit/tizen_4.0/20171103.052456
authorHongkuk, Son <hongkuk.son@samsung.com>
Fri, 3 Nov 2017 01:53:07 +0000 (10:53 +0900)
committerHongkuk, Son <hongkuk.son@samsung.com>
Fri, 3 Nov 2017 01:53:36 +0000 (10:53 +0900)
Signed-off-by: Hongkuk, Son <hongkuk.son@samsung.com>
Change-Id: Ie9cb19fca33409447339e50e9c5f07e6f11aaf1a

packaging/snapshot_history.txt
resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c
resource/csdk/connectivity/src/tcp_adapter/catcpserver.c
resource/csdk/stack/src/ocobserve.c

index 2cb3600..5122241 100755 (executable)
@@ -1,3 +1,9 @@
+http://suprem.sec.samsung.net/jira/browse/CONPRO-1120
+
+commit_info_2017-11-02.txt
+
+commit_id: 76b245106f57facdff8caa062c5b871ad2f42367
+----------------------------------------------------------------------------------------------------------------------------------
 http://suprem.sec.samsung.net/jira/browse/CONPRO-1110
 
 commit_info_2017-10-25.txt
index 67905f6..ac6f6d7 100644 (file)
@@ -471,17 +471,32 @@ CAResult_t CATCPDisconnectSession(const CAEndpoint_t *endpoint)
     if (CA_STATUS_OK != res)
     {
         OIC_LOG(ERROR, TAG, "failed to close TLS session");
+        res = CAQueueingThreadClearContextData(g_sendQueueHandle,
+                                               CAClearQueueEndpointDataContext,
+                                               endpoint);
+        if (CA_STATUS_OK != res)
+        {
+            OIC_LOG(ERROR, TAG, "failed to clear context data");
+        }
+
         return res;
     }
 #endif
+
     res = CASearchAndDeleteTCPSession(endpoint);
     if (CA_STATUS_OK != res)
     {
         OIC_LOG(ERROR, TAG, "failed to close TCP session");
     }
+
     res = CAQueueingThreadClearContextData(g_sendQueueHandle,
                                            CAClearQueueEndpointDataContext,
                                            endpoint);
+    if (CA_STATUS_OK != res)
+    {
+        OIC_LOG(ERROR, TAG, "failed to clear context data");
+    }
+
     return res;
 }
 
index 16ed703..eaee7f3 100644 (file)
@@ -612,14 +612,10 @@ static void CAReceiveMessage(int fd)
     //disconnect session and clean-up data if any error occurs
     if (res != CA_STATUS_OK)
     {
-#ifdef __WITH_TLS__
-        if (CA_STATUS_OK != CAcloseSslConnection(&svritem->sep.endpoint))
+        if (CA_STATUS_OK != CATCPDisconnectSession(&svritem->sep.endpoint))
         {
-            OIC_LOG(ERROR, TAG, "Failed to close TLS session");
+            OIC_LOG(ERROR, TAG, "Failed to disconnect TCP session");
         }
-#endif
-        CASearchAndDeleteTCPSession(&(svritem->sep.endpoint));
-        return;
     }
 }
 
@@ -1113,20 +1109,27 @@ static ssize_t sendData(const CAEndpoint_t *endpoint, const void *data,
     ssize_t remainLen = dlen;
     do
     {
+        size_t sendCounter = 0;
 #ifdef MSG_NOSIGNAL
-        ssize_t len = send(sockFd, data, remainLen, MSG_NOSIGNAL);
+        ssize_t len = send(sockFd, data, remainLen, MSG_DONTWAIT | MSG_NOSIGNAL);
 #else
-        ssize_t len = send(sockFd, data, remainLen, 0);
+        ssize_t len = send(sockFd, data, remainLen, MSG_DONTWAIT);
 #endif
         if (-1 == len)
         {
-            if (EWOULDBLOCK != errno)
+            if (EWOULDBLOCK != errno && EAGAIN != errno)
             {
                 OIC_LOG_V(ERROR, TAG, "unicast ipv4tcp sendTo failed: %s", strerror(errno));
                 CALogSendStateInfo(endpoint->adapter, endpoint->addr, endpoint->port,
                                    len, false, strerror(errno));
                 return len;
             }
+            sendCounter++;
+            OIC_LOG_V(WARNING, TAG, "send blocked. trying %n attempt from 100", sendCounter);
+            if(sendCounter >= 100)
+            {
+                return len;
+            }
             continue;
         }
         data += len;
index d2cc07c..db055ba 100644 (file)
@@ -657,8 +657,9 @@ ResourceObserver* GetObserverUsingToken (const CAToken_t token, uint8_t tokenLen
             if ((memcmp(out->token, token, tokenLength) == 0))
             {
                 OIC_LOG(INFO, TAG, "Found in observer list");
+                ResourceObserver *observer = CloneObserverNode(out);
                 oc_mutex_unlock(g_serverObsListMutex);
-                return CloneObserverNode(out);
+                return observer;
             }
             CheckTimedOutObserver(out);
         }