\r
while(iter)\r
{\r
- NSCacheTopicSubData * curr = (NSCacheTopicSubData)iter->data;\r
+ NSCacheTopicSubData * curr = (NSCacheTopicSubData *)iter->data;\r
\r
if(curr && strcmp(curr->id, consumerId) == 0)\r
{\r
pthread_mutex_unlock(&NSCacheMutex);\r
return cnt;\r
}\r
+\r
+bool NSProviderIsTopicSubScribed(NSCacheElement * conTopicList, char * cId, char * topicName)\r
+{\r
+ pthread_mutex_lock(&NSCacheMutex);\r
+\r
+ if(!conTopicList || !cId || !topicName)\r
+ {\r
+ return false;\r
+ pthread_mutex_unlock(&NSCacheMutex);\r
+ }\r
+\r
+ NSCacheElement * iter = conTopicList;\r
+ while(iter)\r
+ {\r
+ NSCacheTopicSubData * curr = (NSCacheTopicSubData *) iter->data;\r
+\r
+ if( (strcmp(curr->id, cId) == 0) && (strcmp(curr->topicName, topicName) == 0) )\r
+ {\r
+ pthread_mutex_unlock(&NSCacheMutex);\r
+ return true;\r
+ }\r
+ iter = iter->next;\r
+ }\r
+\r
+ pthread_mutex_unlock(&NSCacheMutex);\r
+ return false;\r
+}\r
\r
size_t NSProviderGetListSize(NSCacheElement * firstElement);\r
\r
+bool NSProviderIsTopicSubScribed(NSCacheElement * conTopicList, char * cId, char * topicName);\r
+\r
pthread_mutex_t NSCacheMutex;\r
pthread_mutexattr_t NSCacheMutexAttr;\r
\r
return NS_ERROR;
}
- NS_LOG_V(DEBUG, "this is topic message: %s", msg->topic);
-
NSCacheElement * it = consumerSubList->head;
while (it)
{
if(msg->topic)
{
+ NS_LOG_V(DEBUG, "this is topic message: %s", msg->topic);
+
if(NSIsTopicSubscribed(subData->id, msg->topic))
{
obArray[obCount++] = subData->messageObId;
\r
bool NSIsTopicSubscribed(char * consumerId, char * topic)\r
{\r
- //TODO: implement function\r
- return true;\r
+ return NSProviderIsTopicSubScribed(consumerTopicList->head, consumerId, topic);\r
}\r
\r
NSResult NSPostConsumerTopics(OCEntityHandlerRequest * entityHandlerRequest)\r