Skip to content

Commit

Permalink
Enhanced connectivity monitor error fix (rdkcentral#5449)
Browse files Browse the repository at this point in the history
* Enahanced Connectivity monitor

* ip address change event not coming when wifi reconnect happense

(cherry picked from commit c4d1e81)
  • Loading branch information
cmuhammedrafi committed Jul 2, 2024
1 parent 8e18301 commit 519a3b8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
12 changes: 7 additions & 5 deletions NetworkManager/NetworkManagerConnectivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ namespace WPEFramework
/* set our custom set of headers */
curl_easy_setopt(curl_easy_handle, CURLOPT_HTTPHEADER, chunk);
curl_easy_setopt(curl_easy_handle, CURLOPT_USERAGENT, "RDKCaptiveCheck/1.0");
curl_easy_setopt(curl_easy_handle, CURLOPT_CONNECT_ONLY, 1L);
if(!headReq) {
if(!headReq)
{
// NMLOG_TRACE("curlopt get request");
/* HTTPGET request added insted of HTTPHEAD request fix for DELIA-61526 */
curl_easy_setopt(curl_easy_handle, CURLOPT_HTTPGET, 1L);
Expand Down Expand Up @@ -393,13 +393,13 @@ namespace WPEFramework
nsm_internetState internetState = nsm_internetState::UNKNOWN;
// If monitor connectivity is running take the cache value

if ( doContinuousMonitor && nsm_ipversion::NSM_IPRESOLVE_V4 == ipversion
if ( doContinuousMonitor && (nsm_ipversion::NSM_IPRESOLVE_V4 == ipversion || nsm_ipversion::NSM_IPRESOLVE_WHATEVER == ipversion)
&& gIpv4InternetState != nsm_internetState::UNKNOWN ) {
NMLOG_WARNING("Reading Ipv4 internet state cached value %s", getInternetStateString(gIpv4InternetState));
internetState = gIpv4InternetState;
}
else if ( doContinuousMonitor && nsm_ipversion::NSM_IPRESOLVE_V6 == ipversion
&& gIpv6InternetState != nsm_internetState::UNKNOWN ) {
else if ( doContinuousMonitor && (nsm_ipversion::NSM_IPRESOLVE_V6 == ipversion || nsm_ipversion::NSM_IPRESOLVE_WHATEVER == ipversion)
&& gIpv6InternetState != nsm_internetState::UNKNOWN ) {
NMLOG_WARNING("Reading Ipv6 internet state cached value %s", getInternetStateString(gIpv6InternetState));
internetState = gIpv6InternetState;
}
Expand Down Expand Up @@ -476,6 +476,8 @@ namespace WPEFramework
{
ginterfaceStatus = interfaceStatus; /* this will give interface status connected/ disconnected */
gInternetState = UNKNOWN;
gIpv4InternetState = nsm_internetState::UNKNOWN;
gIpv6InternetState = nsm_internetState::UNKNOWN;
if (doConnectivityMonitor)
{
cvConnectivityMonitor.notify_one();
Expand Down
3 changes: 1 addition & 2 deletions NetworkManager/NetworkManagerConnectivity.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,12 @@ enum nsm_connectivity_httpcode {

#define NMCONNECTIVITY_CURL_HEAD_REQUEST true
#define NMCONNECTIVITY_CURL_GET_REQUEST false
#define NMCONNECTIVITY_DNS_RESOLVE_FILE "/etc/resolv.dnsmasq"

#define NMCONNECTIVITY_MONITOR_DEFAULT_INTERVAL 60 // sec
#define NMCONNECTIVITY_MONITOR_MIN_INTERVAL 5 // sec
#define NMCONNECTIVITY_CURL_REQUEST_TIMEOUT_MS 5000 // ms
#define NMCONNECTIVITY_NO_INTERNET_RETRY_COUNT 4 // 4 retry
#define NMCONNECTIVITY_CONN_MONITOR_RETRY_COUNT 4 // 4 retry
#define NMCONNECTIVITY_CONN_MONITOR_RETRY_COUNT 3 // 3 retry
#define NMCONNECTIVITY_CAPTIVE_MONITOR_INTERVAL 30 // sec
#define NMCONNECTIVITY_CONN_MONITOR_RETRY_INTERVAL 30 // sec

Expand Down
7 changes: 6 additions & 1 deletion NetworkManager/NetworkManagerRDKProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,13 @@ namespace WPEFramework
NMLOG_INFO ("IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_CONNECTION_STATUS :: %s", interface.c_str());
if(interface == "eth0" || interface == "wlan0")
{
if (e->status)
if (e->status) {
if (interface == "wlan0") {
// ip address change event not coming when wifi reconnected
::_instance->connectivityMonitor.startConnectivityMonitor(true);
}
::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_LINK_UP, interface);
}
else {
::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_LINK_DOWN, interface);
/* when ever interface down we start connectivity monitor to post noInternet event */
Expand Down

0 comments on commit 519a3b8

Please sign in to comment.