From 8628ed7c58d2c831e7b8dea3ded9a677954b973f Mon Sep 17 00:00:00 2001 From: Mandeep Shetty Date: Thu, 30 Jul 2015 11:47:40 -0700 Subject: [PATCH] Fixed unprocessed timed-out messages in the stack. 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/1995 Tested-by: jenkins-iotivity Reviewed-by: Omkar Hegde Reviewed-by: Joseph Morrow Reviewed-by: Erich Keane --- resource/csdk/stack/src/ocstack.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index c86967f..bc806fe 100644 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -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); } -- 2.7.4