Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Handle network change
01-09-2015, 12:29 PM
Post: #18
RE: Handle network change
I debug and debug and probably found solution for my issue.
Could you check if that patch could be applied to official repo

Code:
diff --git a/OpenHome/Net/Device/Upnp/DviProtocolUpnp.cpp b/OpenHome/Net/Device/Upnp/DviProtocolUpnp.cpp
index 38c6db3..75538f4 100644
--- a/OpenHome/Net/Device/Upnp/DviProtocolUpnp.cpp
+++ b/OpenHome/Net/Device/Upnp/DviProtocolUpnp.cpp
@@ -138,11 +138,15 @@ DviProtocolUpnpAdapterSpecificData* DviProtocolUpnp::AddInterface(const NetworkA
     TIpAddress addr = aAdapter.Address();
     Bws<Uri::kMaxUriBytes> uriBase;
     TUint port = iServer->Port(addr);
-    DviDevice* root = (iDevice.IsRoot()? &iDevice : iDevice.Root());
-    root->GetUriBase(uriBase, addr, port, *this);
-    DviProtocolUpnpAdapterSpecificData* adapter = new DviProtocolUpnpAdapterSpecificData(iDvStack, *this, aAdapter, uriBase, port);
-    iAdapters.push_back(adapter);
-    return adapter;
+    if(port != 0){
+        DviDevice* root = (iDevice.IsRoot()? &iDevice : iDevice.Root());
+        root->GetUriBase(uriBase, addr, port, *this);
+        DviProtocolUpnpAdapterSpecificData* adapter = new DviProtocolUpnpAdapterSpecificData(iDvStack, *this, aAdapter, uriBase, port);
+        iAdapters.push_back(adapter);
+        return adapter;
+    }else{
+        return NULL;
+    }
}

void DviProtocolUpnp::HandleInterfaceChange()
@@ -166,13 +170,13 @@ void DviProtocolUpnp::HandleInterfaceChange()
                     pendingDelete.push_back(iAdapters[i]);
                     iAdapters.erase(iAdapters.begin() + i);
                 }
-                // add listener if 'current' is a new subnet
-                if (iAdapters.size() == 0) {
-                    iDvStack.SsdpNotifierManager().Stop(iDevice.Udn());
-                    DviProtocolUpnpAdapterSpecificData* adapter = AddInterface(*current);
-                    if (iDevice.Enabled()) {
-                        adapter->SendByeByeThenAlive(*this);
-                    }
+            }
+            // add listener if 'current' is a new subnet
+            if (iAdapters.size() == 0) {
+                iDvStack.SsdpNotifierManager().Stop(iDevice.Udn());
+                DviProtocolUpnpAdapterSpecificData* adapter = AddInterface(*current);
+                if (adapter!= NULL && iDevice.Enabled()) {
+                    adapter->SendByeByeThenAlive(*this);
                 }
             }
         }
Find all posts by this user


Messages In This Thread
Handle network change - SiMet - 19-06-2015, 01:10 PM
RE: Handle network change - simonc - 19-06-2015, 04:20 PM
RE: Handle network change - SiMet - 19-06-2015, 08:02 PM
RE: Handle network change - SiMet - 23-06-2015, 10:13 AM
RE: Handle network change - simonc - 23-06-2015, 12:36 PM
RE: Handle network change - SiMet - 23-06-2015, 03:03 PM
RE: Handle network change - SiMet - 24-06-2015, 02:11 PM
RE: Handle network change - simonc - 24-06-2015, 03:07 PM
RE: Handle network change - SiMet - 25-06-2015, 06:20 AM
RE: Handle network change - SiMet - 02-07-2015, 01:40 PM
RE: Handle network change - simonc - 02-07-2015, 04:22 PM
RE: Handle network change - simonc - 30-07-2015, 04:53 PM
RE: Handle network change - SiMet - 05-08-2015, 12:07 PM
RE: Handle network change - simonc - 07-08-2015, 01:51 PM
RE: Handle network change - SiMet - 11-08-2015, 12:15 PM
RE: Handle network change - SiMet - 20-08-2015, 12:33 PM
RE: Handle network change - SiMet - 01-09-2015, 08:13 AM
RE: Handle network change - simonc - 11-09-2015, 03:16 PM
RE: Handle network change - SiMet - 01-09-2015 12:29 PM
RE: Handle network change - simonc - 03-09-2015, 01:33 PM
RE: Handle network change - SiMet - 07-09-2015, 09:44 AM
RE: Handle network change - SiMet - 14-09-2015, 08:15 AM
RE: Handle network change - simonc - 28-09-2015, 02:12 PM

Forum Jump: