Fix CA DTLS handshake retransmission timer
authorDmitriy Zhuravlev <d.zhuravlev@samsung.com>
Fri, 27 May 2016 12:50:45 +0000 (15:50 +0300)
committerRandeep Singh <randeep.s@samsung.com>
Wed, 8 Jun 2016 08:51:33 +0000 (08:51 +0000)
registerTimer allows only positive integers
which can not be less than RETRANSMISSION_TIME = 1 sec

Change-Id: Ide9344e0eb703564558626a74f754e394288fa1d
Signed-off-by: Dmitriy Zhuravlev <d.zhuravlev@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8369
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Chul Lee <chuls.lee@samsung.com>
Reviewed-by: Jongsung Lee <js126.lee@samsung.com>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
resource/csdk/connectivity/src/adapter_util/caadapternetdtls.c

index 8caf45f..43f7337 100644 (file)
@@ -71,10 +71,10 @@ static ca_mutex g_dtlsContextMutex = NULL;
 static CAGetDTLSPskCredentialsHandler g_getCredentialsCallback = NULL;
 
 /**
- * @var MAX_RETRANSMISSION_TIME
+ * @var RETRANSMISSION_TIME
  * @brief Maximum timeout value (in seconds) to start DTLS retransmission.
  */
-#define MAX_RETRANSMISSION_TIME 1
+#define RETRANSMISSION_TIME 1
 
 /**
  * @var g_dtlsHandshakeCallback
@@ -1013,10 +1013,6 @@ exit:
 static void CAStartRetransmit()
 {
     static int timerId = -1;
-    clock_time_t nextSchedule = MAX_RETRANSMISSION_TIME;
-
-    OIC_LOG(DEBUG, NET_DTLS_TAG, "CAStartRetransmit IN");
-
     if (timerId != -1)
     {
         //clear previous timer
@@ -1031,25 +1027,11 @@ static void CAStartRetransmit()
             ca_mutex_unlock(g_dtlsContextMutex);
             return;
         }
-
-        OIC_LOG(DEBUG, NET_DTLS_TAG, "Check retransmission");
-        dtls_check_retransmit(g_caDtlsContext->dtlsContext, &nextSchedule);
+        dtls_check_retransmit(g_caDtlsContext->dtlsContext, NULL);
         ca_mutex_unlock(g_dtlsContextMutex);
-
-        //re-transmission timeout should not be greater then max one
-        //this will cover case when several clients start dtls sessions
-        nextSchedule /= CLOCKS_PER_SEC;
-        if (nextSchedule > MAX_RETRANSMISSION_TIME)
-        {
-            nextSchedule = MAX_RETRANSMISSION_TIME;
-        }
     }
-
     //start new timer
-    OIC_LOG(DEBUG, NET_DTLS_TAG, "Start new timer");
-    registerTimer(nextSchedule, &timerId, CAStartRetransmit);
-
-    OIC_LOG(DEBUG, NET_DTLS_TAG, "CAStartRetransmit OUT");
+    registerTimer(RETRANSMISSION_TIME, &timerId, CAStartRetransmit);
 }
 
 CAResult_t CAAdapterNetDtlsInit()