Fix bug for discover logic on consumer service.
authorKIM JungYong <jyong2.kim@samsung.com>
Mon, 29 Aug 2016 04:43:56 +0000 (13:43 +0900)
committerUze Choi <uzchoi@samsung.com>
Mon, 29 Aug 2016 07:46:24 +0000 (07:46 +0000)
1) Modify default connectivity type of discover requestion.
When consumer service run the discover provider,
Connectivity type of request was CT_DEFAULT.
It original meaning was CT_ADAPTER_IP.

2) Remove meaningless memory allocation.
When discover as TCP, we use of allocated context data.
But, this context data unnecessary to allocate.

Change-Id: I2fab71f5352485f04b17b3e7fdd9cda254ebeab9
Signed-off-by: KIM JungYong <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/11017
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/notification/src/consumer/NSConsumerDiscovery.c

index 52bf446..e28a17a 100644 (file)
@@ -161,7 +161,6 @@ OCStackApplicationResult NSIntrospectProvider(
     if (ctx && *((NSConsumerDiscoverType *)ctx) == NS_DISCOVER_CLOUD )
     {
         newProvider->connection->isCloudConnection = true;
-        NSOICFree(ctx);
     }
 
     NS_LOG(DEBUG, "build NSTask");
@@ -293,14 +292,13 @@ OCDevAddr * NSChangeAddress(const char * address)
 
 void NSConsumerHandleRequestDiscover(OCDevAddr * address, NSConsumerDiscoverType rType)
 {
-    OCConnectivityType type = CT_DEFAULT;
+    OCConnectivityType type = CT_ADAPTER_IP;
     NSConsumerDiscoverType * callbackData = NULL;
 
     if (address)
     {
         if (address->adapter == OC_ADAPTER_IP)
         {
-            type = CT_ADAPTER_IP;
             NS_LOG(DEBUG, "Request discover [UDP]");
         }
         else if (address->adapter == OC_ADAPTER_TCP)
@@ -313,7 +311,6 @@ void NSConsumerHandleRequestDiscover(OCDevAddr * address, NSConsumerDiscoverType
 
             if (rType == NS_DISCOVER_CLOUD)
             {
-                callbackData = (NSConsumerDiscoverType *)OICMalloc(sizeof(NSConsumerDiscoverType));
                 *callbackData = NS_DISCOVER_CLOUD;
             }
         }