[IOT-1081] Fix for discoverying old resource servers
authorMarkus Jung <markus.jung@samsung.com>
Tue, 12 Apr 2016 05:57:15 +0000 (14:57 +0900)
committerUze Choi <uzchoi@samsung.com>
Tue, 12 Apr 2016 07:46:23 +0000 (07:46 +0000)
Catch ResourceInitException and ignoring old resource servers

Change-Id: Idd3dd3853cadc63aeb83a2ccaba54b1fd5de88a0
Signed-off-by: Markus Jung <markus.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/7753
Reviewed-by: Mushfiqul Islam <i.mushfiq@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
resource/src/InProcClientWrapper.cpp

index 2e2388a..32293f8 100644 (file)
@@ -165,13 +165,19 @@ namespace OC
             return OC_STACK_KEEP_TRANSACTION;
         }
 
-        ListenOCContainer container(clientWrapper, clientResponse->devAddr,
-                                reinterpret_cast<OCDiscoveryPayload*>(clientResponse->payload));
-        // loop to ensure valid construction of all resources
-        for(auto resource : container.Resources())
-        {
-            std::thread exec(context->callback, resource);
-            exec.detach();
+        try{
+            ListenOCContainer container(clientWrapper, clientResponse->devAddr,
+                                    reinterpret_cast<OCDiscoveryPayload*>(clientResponse->payload));
+            // loop to ensure valid construction of all resources
+            for(auto resource : container.Resources())
+            {
+                std::thread exec(context->callback, resource);
+                exec.detach();
+            }
+        }
+        catch (std::exception &e){
+            oclog() << "Exception in listCallback, ignoring response: "
+                    << e.what() << std::flush;
         }