From fa937cc9859953827d02f2ec3e0b26e74aff33a5 Mon Sep 17 00:00:00 2001 From: "jaesick.shin" Date: Tue, 16 Aug 2016 10:50:14 +0900 Subject: [PATCH] Bug fixes for initialize condition of TopicList. Remove initialize condition variable for topiclist. not required that variable. Change-Id: Ia63540bbff0998729797e51019f5a288f9702641 Signed-off-by: jaesick.shin Reviewed-on: https://gerrit.iotivity.org/gerrit/10475 Reviewed-by: Chihyun Cho Reviewed-by: Uze Choi Tested-by: Uze Choi --- service/notification/src/provider/NSProviderMemoryCache.c | 7 ++----- service/notification/src/provider/NSProviderTopic.c | 13 ------------- service/notification/unittest/NSProviderTest.cpp | 3 +++ 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/service/notification/src/provider/NSProviderMemoryCache.c b/service/notification/src/provider/NSProviderMemoryCache.c index 8e4b4d9..e8583d9 100644 --- a/service/notification/src/provider/NSProviderMemoryCache.c +++ b/service/notification/src/provider/NSProviderMemoryCache.c @@ -256,21 +256,17 @@ NSResult NSStorageDestroy(NSCacheList * list) { NSCacheElement * iter = list->head; NSCacheElement * next = NULL; - NSCacheType type = list->cacheType; while (iter) { next = (NSCacheElement *) iter->next; - NSProviderDeleteCacheData(type, iter->data); OICFree(iter); - iter = next; } OICFree(list); - return NS_OK; } @@ -372,7 +368,8 @@ NSResult NSProviderDeleteCacheData(NSCacheType type, void * data) NSCacheTopicData * data = (NSCacheTopicData *) data; OICFree(data->topicName); } - else if(type == NS_PROVIDER_CACHE_CONSUMER_TOPIC_NAME || NS_PROVIDER_CACHE_CONSUMER_TOPIC_CID) + else if(type == NS_PROVIDER_CACHE_CONSUMER_TOPIC_NAME || + type == NS_PROVIDER_CACHE_CONSUMER_TOPIC_CID) { NSCacheTopicSubData * data = (NSCacheTopicSubData *) data; OICFree(data->topicName); diff --git a/service/notification/src/provider/NSProviderTopic.c b/service/notification/src/provider/NSProviderTopic.c index 93577d8..6fffb99 100644 --- a/service/notification/src/provider/NSProviderTopic.c +++ b/service/notification/src/provider/NSProviderTopic.c @@ -20,29 +20,17 @@ #include "NSProviderTopic.h" -static bool isTopicList = false; - -NSResult NSStoreTopics(const char * topicName); NSResult NSSendTopicUpdation(); NSResult NSInitTopicList() { NS_LOG(DEBUG, "NSInitTopicList - IN"); - - if(isTopicList) - { - NS_LOG(DEBUG, "topic list has already initiated"); - return NS_FAIL; - } - consumerTopicList = NSStorageCreate(); consumerTopicList->cacheType = NS_PROVIDER_CACHE_CONSUMER_TOPIC_NAME; registeredTopicList = NSStorageCreate(); registeredTopicList->cacheType = NS_PROVIDER_CACHE_REGISTER_TOPIC; - isTopicList = true; - NS_LOG(DEBUG, "NSInitTopicList - OUT"); return NS_OK; } @@ -102,7 +90,6 @@ NSResult NSDeleteTopics(const char * topicName) NSStorageDelete(registeredTopicList, topicName); while(NSStorageDelete(consumerTopicList, topicName) != NS_FAIL); - return NS_OK; } diff --git a/service/notification/unittest/NSProviderTest.cpp b/service/notification/unittest/NSProviderTest.cpp index ce86a03..7b3eeef 100755 --- a/service/notification/unittest/NSProviderTest.cpp +++ b/service/notification/unittest/NSProviderTest.cpp @@ -136,6 +136,7 @@ TEST_F(NotificationProviderTest, StartProviderPositiveWithNSPolicyTrue) config.subRequestCallback = NSRequestedSubscribeCallbackEmpty; config.syncInfoCallback = NSSyncCallbackEmpty; config.policy = true; + config.userInfo = NULL; NSResult ret = NSStartProvider(config); @@ -161,6 +162,7 @@ TEST_F(NotificationProviderTest, StartProviderPositiveWithNSPolicyFalse) config.subRequestCallback = NSRequestedSubscribeCallbackEmpty; config.syncInfoCallback = NSSyncCallbackEmpty; config.policy = false; + config.userInfo = NULL; NSResult ret = NSStartProvider(config); @@ -188,6 +190,7 @@ TEST_F(NotificationProviderTest, ExpectCallbackWhenReceiveSubscribeRequestWithAc config.subRequestCallback = NSRequestedSubscribeCallbackEmpty; config.syncInfoCallback = NSSyncCallbackEmpty; config.policy = true; + config.userInfo = NULL; NSStartProvider(config); -- 2.7.4