Fixed unprocessed timed-out messages in the stack.
authorMandeep Shetty <mandeep.shetty@intel.com>
Thu, 30 Jul 2015 18:47:40 +0000 (11:47 -0700)
committerErich Keane <erich.keane@intel.com>
Thu, 30 Jul 2015 22:10:58 +0000 (22:10 +0000)
The portion of messages in the retransmission queue did not have the
resourceUri. As a result timed-out messages when reported back to the RI
layer did not have the resource uri which failed a check on entry into
the RI layer.

This caused the server to not de-register observers and it continued to
send observation notifications to a client that is not reachable.

Removed the check for the resource uri to fix the issue.
Added check for presence of uri before comparing it with the presence
uri so presence responses can be handled separately.

This also fixes IOT-622.

Change-Id: Ie3873d02f4163b81094ca1983e79315b85ff4751
Signed-off-by: Mandeep Shetty <mandeep.shetty@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1995
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Omkar Hegde <omkar.m.hegde@intel.com>
Reviewed-by: Joseph Morrow <joseph.l.morrow@intel.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/stack/src/ocstack.c

index c86967f..bc806fe 100644 (file)
@@ -844,7 +844,7 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint,
 
     if (!presenceSubscribe && !multicastPresenceSubscribe)
     {
-         OC_LOG(ERROR, TAG, PCF("Received a presence notification, but no callback, ignoring"));
+        OC_LOG(ERROR, TAG, PCF("Received a presence notification, but no callback, ignoring"));
         goto exit;
     }
 
@@ -997,10 +997,11 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res
 {
     VERIFY_NON_NULL_NR(endPoint, FATAL);
     VERIFY_NON_NULL_NR(responseInfo, FATAL);
-    VERIFY_NON_NULL_NR(responseInfo->info.resourceUri, FATAL);
+
     OC_LOG(INFO, TAG, PCF("Enter HandleCAResponses"));
 
-    if(strcmp(responseInfo->info.resourceUri, OC_RSRVD_PRESENCE_URI) == 0)
+    if(responseInfo->info.resourceUri &&
+        strcmp(responseInfo->info.resourceUri, OC_RSRVD_PRESENCE_URI) == 0)
     {
         HandlePresenceResponse(endPoint, responseInfo);
         return;
@@ -1169,8 +1170,7 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res
             }
             else
             {
-                OC_LOG(INFO, TAG, PCF("Received a response or notification,\
-                        but I do not have callback. Sending RESET"));
+                OC_LOG(INFO, TAG, PCF("Received a message without callbacks. Sending RESET"));
                 SendDirectStackResponse(endPoint, responseInfo->info.messageId, CA_EMPTY,
                         CA_MSG_RESET, 0, NULL, NULL, 0);
             }