Crash in select
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / tcp_adapter / catcpserver.c
index 40c076d..081775e 100644 (file)
@@ -330,7 +330,6 @@ static void CAFindReadyMessage()
         }
     }
     oc_mutex_unlock(g_mutexObjectList);
-
     int ret = poll(readFds, counter, timeout);
 
     oc_mutex_lock(g_mutexObjectList);
@@ -347,6 +346,11 @@ static void CAFindReadyMessage()
     {
         CAPollReturned(readFds, counter);
     }
+    else if (ret == 0)
+    {
+        usleep(1000); /* some of the fields are not set by kernel on repeatedly calling
+                         poll.Applying a timeout will solve this*/
+    }
     else if (ret < 0)
     {
         OIC_LOG_V(FATAL, TAG, "poll error %s", strerror(errno));