From 8c877ff1b1b1f9554b76c9a86ed2497cf02d9932 Mon Sep 17 00:00:00 2001 From: Kush Date: Tue, 10 Apr 2018 12:44:19 +0530 Subject: [PATCH] [CONPRO-1269] Creating socket everytime when network bearer changes Socket was created only once but changed the logic for creating on every network change https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/280 (cherry picked from commit eaa97ac11871f5536ca12e7ab2f9c848b4d99afd) Change-Id: Iaeabe733b6b8728ae74b1903d49c9596dcf021e8 Signed-off-by: Kush Signed-off-by: Amit KS --- resource/csdk/connectivity/src/ip_adapter/android/caipnwmonitor.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resource/csdk/connectivity/src/ip_adapter/android/caipnwmonitor.c b/resource/csdk/connectivity/src/ip_adapter/android/caipnwmonitor.c index 97a46ca..75f7814 100644 --- a/resource/csdk/connectivity/src/ip_adapter/android/caipnwmonitor.c +++ b/resource/csdk/connectivity/src/ip_adapter/android/caipnwmonitor.c @@ -483,6 +483,11 @@ Java_org_iotivity_ca_CaIpInterface_caIpStateEnabled(JNIEnv *env, jclass class) OIC_LOG(DEBUG, TAG, "Wifi is in Activated State"); CAIPPassNetworkChangesToAdapter(CA_INTERFACE_UP); + /* Added preventive patch for CONRO-1269 + * Network unreachable error was coming whenever WIFI-AP connection is changed. + * To avoid that scenario we are closing and creating sockets again. + */ + CreateMulticastSocket(); // Apply network interface changes. u_arraylist_t *iflist = CAIPGetInterfaceInformation(0); @@ -515,4 +520,6 @@ Java_org_iotivity_ca_CaIpInterface_caIpStateDisabled(JNIEnv *env, jclass class) OIC_LOG(DEBUG, TAG, "Wifi is in Deactivated State"); CAIPPassNetworkChangesToAdapter(CA_INTERFACE_DOWN); + // Closing sockets so that it will be created again when WIFI is activated(CONPRO-1269). + CloseMulticastSocket(); } -- 2.7.4