From 1afea7e35164567269bf9351980d50dd7d61e0a8 Mon Sep 17 00:00:00 2001 From: RAFI <103924677+cmuhammedrafi@users.noreply.github.com> Date: Tue, 4 Jun 2024 20:25:16 +0530 Subject: [PATCH] DELIA-65419, RDKTV-31166: Delay in providing 'oninternetstatuschange' (#5374)(#5407) RDKTV-31166 posting internet event when interface connection changes (#5407) * Update no internet event logic in Network RDKTV-31166 posting internet event when interface connection changes (#5407) * RDKTV-31166 internetStatus Event posting updated * modefiy the same change in network manager (cherry picked from commit 3237958d5fdeda4ea721605ba7f5691a6379cb8e) (cherry picked from commit 00a6207857901d35e6cf6dfba0f38f8574004a13) (cherry picked from commit 672900c539deff36edfc7e32b81ebe126b5e50f3) --- Network/CHANGELOG.md | 4 ++++ Network/Network.cpp | 15 ++++----------- Network/NetworkConnectivity.cpp | 4 +++- NetworkManager/service/NetworkConnectivity.cpp | 1 + 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Network/CHANGELOG.md b/Network/CHANGELOG.md index 907cfe913a..ed485f7111 100644 --- a/Network/CHANGELOG.md +++ b/Network/CHANGELOG.md @@ -16,6 +16,10 @@ All notable changes to this RDK Service will be documented in this file. * For more details, refer to [versioning](https://github.com/rdkcentral/rdkservices#versioning) section under Main README. +## [1.3.11] - 2024-06-19 +### Fixed +- onInternetStatus event not posting error fix + ## [1.3.10] - 2024-04-17 ### Added - added retry logic for connectivity monitor diff --git a/Network/Network.cpp b/Network/Network.cpp index 91835c8e1a..832a0833fe 100644 --- a/Network/Network.cpp +++ b/Network/Network.cpp @@ -35,7 +35,7 @@ using namespace std; #define API_VERSION_NUMBER_MAJOR 1 #define API_VERSION_NUMBER_MINOR 3 -#define API_VERSION_NUMBER_PATCH 10 +#define API_VERSION_NUMBER_PATCH 11 /* Netsrvmgr Based Macros & Structures */ #define IARM_BUS_NM_SRV_MGR_NAME "NET_SRV_MGR" @@ -1461,17 +1461,10 @@ typedef struct _IARM_BUS_NetSrvMgr_Iface_EventData_t { m_defInterfaceCache = ""; sendNotify("onConnectionStatusChanged", params); - if(connected) + connectivityMonitor.doInitialConnectivityMonitoring(30); + if(!connected) { - connectivityMonitor.doInitialConnectivityMonitoring(30); - } - else - { - if (!connectivityMonitor.isMonitorThreadRunning()) - { - /*run the thread again to notify no_internet state*/ - connectivityMonitor.doInitialConnectivityMonitoring(30); - } + /* if disconnectd need to stop the thread after one event */ connectivityMonitor.stopInitialConnectivityMonitoring(); } } diff --git a/Network/NetworkConnectivity.cpp b/Network/NetworkConnectivity.cpp index 621c59b679..7ab7e6398f 100644 --- a/Network/NetworkConnectivity.cpp +++ b/Network/NetworkConnectivity.cpp @@ -493,6 +493,7 @@ namespace WPEFramework { if (isMonitorThreadRunning() && stopFlag == false) { LOGINFO("Connectivity Monitor Thread is active so notify"); + g_internetState = nsm_internetState::UNKNOWN; cv_.notify_all(); } else @@ -578,7 +579,8 @@ namespace WPEFramework { if(g_internetState.load() != InternetConnectionState) { LOGINFO("notification count %d ...", notifyWaitCount); - if(InternetConnectionState == nsm_internetState::NO_INTERNET && notifyWaitCount > 0) + /* Retry logic only need when continuous monitor is running, otherwise post notification immediately */ + if(InternetConnectionState == nsm_internetState::NO_INTERNET && isContinuesMonitoringNeeded && notifyWaitCount > 0) { /* Decrease the notification count to create a delay in posting the 'no internet' state. */ notifyWaitCount--; diff --git a/NetworkManager/service/NetworkConnectivity.cpp b/NetworkManager/service/NetworkConnectivity.cpp index e34688dc1c..9c89470565 100644 --- a/NetworkManager/service/NetworkConnectivity.cpp +++ b/NetworkManager/service/NetworkConnectivity.cpp @@ -486,6 +486,7 @@ namespace WPEFramework { if (isMonitorThreadRunning()) { NMLOG_INFO("Connectivity Monitor Thread is active so notify"); + g_internetState = nsm_internetState::UNKNOWN; cv_.notify_all(); } else