pthread_mutex_lock(&nsInitMutex);
- if(msg == NULL)
+ if (!initProvider || msg == NULL)
{
NS_LOG(ERROR, "Msg is NULL");
pthread_mutex_unlock(&nsInitMutex);
NS_LOG(DEBUG, "NSProviderReadCheck - IN");
pthread_mutex_lock(&nsInitMutex);
+ if (!initProvider)
+ {
+ NS_LOG(ERROR, "Provider is not started");
+ pthread_mutex_unlock(&nsInitMutex);
+ return NS_FAIL;
+ }
+
NSSyncInfo * syncInfo = (NSSyncInfo *)OICMalloc(sizeof(NSSyncInfo));
OICStrcpy(syncInfo->providerId, UUID_STRING_SIZE, NSGetProviderInfo()->providerId);
syncInfo->messageId = messageId;
NS_LOG(DEBUG, "NSAccept - IN");
pthread_mutex_lock(&nsInitMutex);
- if(!consumerId || consumerId[0] == '\0' || NSGetPolicy() == NS_POLICY_CONSUMER)
+ if(!initProvider || !consumerId || consumerId[0] == '\0' || NSGetPolicy() == NS_POLICY_CONSUMER)
{
- NS_LOG(ERROR, "consumerId is NULL or NS Policy is Consumer");
+ NS_LOG(ERROR, "Provider is not started or consumerId is NULL or NS Policy is Consumer");
pthread_mutex_unlock(&nsInitMutex);
return NS_FAIL;
}
NS_LOG(DEBUG, "NSProviderGetConsumerTopics - IN");
pthread_mutex_lock(&nsInitMutex);
- if(!consumerId || consumerId[0] == '\0')
+ if(!initProvider || !consumerId || consumerId[0] == '\0')
{
- NS_LOG(DEBUG, "consumer id should be set");
+ NS_LOG(DEBUG, "Provider is not started or consumer id should be set");
pthread_mutex_unlock(&nsInitMutex);
return NULL;
}
NS_LOG(DEBUG, "NSProviderGetTopics - IN");
pthread_mutex_lock(&nsInitMutex);
+ if (!initProvider)
+ {
+ NS_LOG(ERROR, "Provider is not started");
+ pthread_mutex_unlock(&nsInitMutex);
+ return NULL;
+ }
+
NSTopicSynchronization topics;
topics.consumerId = NULL;
topics.topics = NULL;
NS_LOG(DEBUG, "NSProviderAddTopics - IN");
pthread_mutex_lock(&nsInitMutex);
- if(!topicName || topicName[0] == '\0')
+ if(!initProvider || !topicName || topicName[0] == '\0')
{
pthread_mutex_unlock(&nsInitMutex);
- NS_LOG(DEBUG, "topic Name should be set");
+ NS_LOG(DEBUG, "Provider is not started or topic Name should be set");
return NS_FAIL;
}
NS_LOG(DEBUG, "NSProviderDeleteTopics - IN");
pthread_mutex_lock(&nsInitMutex);
- if(!topicName || topicName[0] == '\0')
+ if(!initProvider || !topicName || topicName[0] == '\0')
{
pthread_mutex_unlock(&nsInitMutex);
- NS_LOG(DEBUG, "topic Name should be set");
+ NS_LOG(DEBUG, "Provider is not started or topic Name should be set");
return NS_FAIL;
}
NS_LOG(DEBUG, "NSProviderSelectTopics - IN");
pthread_mutex_lock(&nsInitMutex);
- if(!consumerId || consumerId[0] == '\0' || !topicName || topicName[0] == '\0' || !NSGetPolicy())
+ if(!initProvider || !consumerId || consumerId[0] == '\0' || !topicName || topicName[0] == '\0'
+ || !NSGetPolicy())
{
- NS_LOG(DEBUG, "consumer id should be set for topic subscription or "
+ NS_LOG(DEBUG, "provider is not started or "
+ "consumer id should be set for topic subscription or "
"Configuration must set to true.");
pthread_mutex_unlock(&nsInitMutex);
return NS_FAIL;
NS_LOG(DEBUG, "NSProviderUnselectTopics - IN");
pthread_mutex_lock(&nsInitMutex);
- if(!consumerId || consumerId[0] == '\0' || !topicName || topicName[0] == '\0' || !NSGetPolicy())
+ if(!initProvider || !consumerId || consumerId[0] == '\0' || !topicName || topicName[0] == '\0'
+ || !NSGetPolicy())
{
- NS_LOG(DEBUG, "consumer id should be set for topic subscription or "
+ NS_LOG(DEBUG, "provider is not started or "
+ "consumer id should be set for topic subscription or "
"Configuration must set to true.");
pthread_mutex_unlock(&nsInitMutex);
return NS_FAIL;