From 91694813b9fb77d16d2cc89c831e0c45ef97a05c 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] RDKTV-31166: Delay in providing 'oninternetstatuschange' (#5407) * RDKTV-31166 internetStatus Event posting updated * modefiy the same change in network manager (cherry picked from commit 672900c539deff36edfc7e32b81ebe126b5e50f3) --- Network/CHANGELOG.md | 4 ++++ Network/Network.cpp | 17 ++++------------- Network/NetworkConnectivity.cpp | 4 +++- NetworkManager/service/NetworkConnectivity.cpp | 1 + 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Network/CHANGELOG.md b/Network/CHANGELOG.md index b94b219fdf..a670335ea2 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.12] - 2024-06-19 +### Fixed +- onInternetStatus event not posting error fix + ## [1.3.11] - 2024-05-13 ### Added - Added connectivity monitor in onInterfaceIPAddressChanged diff --git a/Network/Network.cpp b/Network/Network.cpp index 357586648e..ee7208ef3c 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 11 +#define API_VERSION_NUMBER_PATCH 12 /* Netsrvmgr Based Macros & Structures */ #define IARM_BUS_NM_SRV_MGR_NAME "NET_SRV_MGR" @@ -1508,19 +1508,10 @@ typedef struct _IARM_BUS_NetSrvMgr_Iface_EventData_t { } params["status"] = string (acquired ? "ACQUIRED" : "LOST"); sendNotify("onIPAddressStatusChanged", params); - if(acquired) - { - connectivityMonitor.doInitialConnectivityMonitoring(30); - } - else - { - if (!connectivityMonitor.isMonitorThreadRunning()) - { - /*run the thread again to notify no_internet state*/ - connectivityMonitor.doInitialConnectivityMonitoring(30); - } + + connectivityMonitor.doInitialConnectivityMonitoring(30); + if(!acquired) // lost the ip connectivityMonitor.stopInitialConnectivityMonitoring(); - } } void Network::onDefaultInterfaceChanged(string oldInterface, string newInterface) diff --git a/Network/NetworkConnectivity.cpp b/Network/NetworkConnectivity.cpp index 3de040d393..e6581575ec 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