diff --git a/Network/CHANGELOG.md b/Network/CHANGELOG.md index c0160472e6..33ebf72ca7 100644 --- a/Network/CHANGELOG.md +++ b/Network/CHANGELOG.md @@ -16,6 +16,11 @@ 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.6] - 2024-03-25 +### Fixed +- Fixed WPE_ERR_ProcessCrash with function__libc_do_syscall +- Changed the connectivity monitor thread termination + ## [1.3.5] - 2024-02-19 ### Fixed - Fixed Network connnectivity monitor crash during reboot diff --git a/Network/Network.cpp b/Network/Network.cpp index e653a89d3d..34087aacfe 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 5 +#define API_VERSION_NUMBER_PATCH 6 /* Netsrvmgr Based Macros & Structures */ #define IARM_BUS_NM_SRV_MGR_NAME "NET_SRV_MGR" diff --git a/Network/Network.h b/Network/Network.h index 7d441f5c53..6a8521cd9a 100644 --- a/Network/Network.h +++ b/Network/Network.h @@ -254,7 +254,7 @@ namespace WPEFramework { static Network *_instance; static Network *getInstance() {return _instance;} Config config; - ConnectivityMonitor& connectivityMonitor = ConnectivityMonitor::getInstance(); + ConnectivityMonitor connectivityMonitor; private: PluginHost::IShell* m_service; diff --git a/Network/NetworkConnectivity.cpp b/Network/NetworkConnectivity.cpp index 5caa7c420e..c2010bb1c4 100644 --- a/Network/NetworkConnectivity.cpp +++ b/Network/NetworkConnectivity.cpp @@ -307,7 +307,7 @@ namespace WPEFramework { #if LIBCURL_VERSION_NUM < 0x074200 int numfds, repeats = 0; #endif - char *endpoint; + char *endpoint = nullptr; while (1) { if (CURLM_OK != (mc = curl_multi_perform(curl_multi_handle, &handles))) @@ -324,7 +324,7 @@ namespace WPEFramework { curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &endpoint); if (curl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE, &response_code) == CURLE_OK) { if(curlVerboseEnabled()) - LOGINFO("endpoint = <%s> response code <%d>",endpoint, static_cast(response_code)); + LOGINFO("endpoint = <%s> http response code <%d>", endpoint, static_cast(response_code)); if (HttpStatus_302_Found == response_code) { if ( (curl_easy_getinfo(msg->easy_handle, CURLINFO_REDIRECT_URL, &url) == CURLE_OK) && url != nullptr) { //LOGWARN("captive portal found !!!"); @@ -333,8 +333,8 @@ namespace WPEFramework { } } } - //else - // LOGERR("endpoint = <%s> error = %d (%s)", endpoint, msg->data.result, curl_easy_strerror(msg->data.result)); + else + LOGERR("endpoint = <%s> curl error = %d (%s)", endpoint, msg->data.result, curl_easy_strerror(msg->data.result)); http_responses.push_back(response_code); } time_earlier = time_now; @@ -429,7 +429,11 @@ namespace WPEFramework { break; default: InternetConnectionState = NO_INTERNET; - LOGINFO("Internet State: NO_INTERNET Response code: <%d> %.1f%%", static_cast(http_response_code), (percentage*100)); + if(http_response_code == -1) + LOGERR("Internet State: NO_INTERNET curl error"); + else + LOGWARN("Internet State: NO_INTERNET Received http response code: <%d> %.1f%%", static_cast(http_response_code), percentage * 100); + break; } } @@ -513,40 +517,40 @@ namespace WPEFramework { bool ConnectivityMonitor::stopInitialConnectivityMonitoring() { - if (isMonitorThreadRunning()) + + if(isContinuesMonitoringNeeded) + { + LOGWARN("Continuous Connectivity Monitor is running"); + return true; + } + else { - if(isContinuesMonitoringNeeded) + if (!isMonitorThreadRunning()) { - LOGWARN("Continuous Connectivity Monitor is running"); - return true; + LOGWARN("Connectivity monitor not running"); } - else - { - stopFlag = true; - cv_.notify_all(); - if (thread_.joinable()) { - thread_.join(); - threadRunning = false; - LOGINFO("Stoping Initial Connectivity Monitor"); - } - else - LOGWARN("thread not joinable !"); + stopFlag = true; + cv_.notify_all(); + + if (thread_.joinable()) + { + thread_.join(); + threadRunning = false; + LOGINFO("Stoping Initial Connectivity Monitor"); } + else + LOGWARN("thread not joinable !"); } - else - LOGWARN("Continuous Connectivity Monitor not running"); return true; } bool ConnectivityMonitor::stopContinuousConnectivityMonitoring() { - LOGINFO("Entry"); if (!isMonitorThreadRunning()) { LOGWARN("Connectivity monitor not running"); - return false; } cv_.notify_all(); stopFlag = true; @@ -595,17 +599,12 @@ namespace WPEFramework { if(stopFlag) { - LOGWARN("stopFlag true exiting"); threadRunning = false; break; } //wait for next timout or conditon signal std::unique_lock lock(mutex_); - if (cv_.wait_for(lock, std::chrono::seconds(timeout.load())) == std::cv_status::timeout) - { - LOGINFO("Connectivity monitor thread timeout"); - } - else + if (cv_.wait_for(lock, std::chrono::seconds(timeout.load())) != std::cv_status::timeout) { if(!stopFlag) { diff --git a/Network/NetworkConnectivity.h b/Network/NetworkConnectivity.h index a988af69e5..565cf22cc5 100644 --- a/Network/NetworkConnectivity.h +++ b/Network/NetworkConnectivity.h @@ -101,11 +101,6 @@ namespace WPEFramework { class ConnectivityMonitor : public Connectivity { public: - static ConnectivityMonitor& getInstance() { - static ConnectivityMonitor instance; - return instance; - } - bool isConnectedToInternet(nsm_ipversion ipversion); nsm_internetState getInternetConnectionState(nsm_ipversion ipversion); std::string getCaptivePortalURI(); @@ -119,7 +114,6 @@ namespace WPEFramework { void signalConnectivityMonitor(); void resetConnectivityCache() { g_internetState = nsm_internetState::UNKNOWN;} - private: ConnectivityMonitor() : stopFlag(false), threadRunning(false), isContinuesMonitoringNeeded(false) { setConnectivityMonitorEndpoints(getConnectivityDefaultEndpoints()); @@ -129,6 +123,7 @@ namespace WPEFramework { LOGINFO("~ConnectivityMonitor"); stopContinuousConnectivityMonitoring(); } + private: std::vector getConnectivityMonitorEndpoints(); ConnectivityMonitor(const ConnectivityMonitor&) = delete;