Skip to content

Commit

Permalink
RDKTV-31166: Delay in providing 'oninternetstatuschange' (#5407)
Browse files Browse the repository at this point in the history
* RDKTV-31166 internetStatus Event posting updated
* modefiy the same change in network manager

(cherry picked from commit 672900c)
  • Loading branch information
cmuhammedrafi committed Jun 19, 2024
1 parent 36dd6af commit 9169481
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
4 changes: 4 additions & 0 deletions Network/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 4 additions & 13 deletions Network/Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion Network/NetworkConnectivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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--;
Expand Down
1 change: 1 addition & 0 deletions NetworkManager/service/NetworkConnectivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9169481

Please sign in to comment.