diff --git a/NetworkManagerConnectivity.cpp b/NetworkManagerConnectivity.cpp index f76c8b4b..d33db4d7 100644 --- a/NetworkManagerConnectivity.cpp +++ b/NetworkManagerConnectivity.cpp @@ -158,12 +158,12 @@ namespace WPEFramework curl_easy_setopt(curl_easy_handle, CURLOPT_TIMEOUT_MS, deadline - current_time()); if ((ipversion == CURL_IPRESOLVE_V4) || (ipversion == CURL_IPRESOLVE_V6)) { - NMLOG_DEBUG("curlopt ipversion = %s reqtyp = %s", ipversion == CURL_IPRESOLVE_V4?"ipv4 only":"ipv6 only", headReq? "HEAD":"GET"); + NMLOG_INFO("curlopt ipversion = %s reqtyp = %s", ipversion == CURL_IPRESOLVE_V4?"IPv4":"IPv6", headReq? "HEAD":"GET"); curl_easy_setopt(curl_easy_handle, CURLOPT_IPRESOLVE, ipversion); } else { - NMLOG_DEBUG("curlopt ipversion = whatever reqtyp = %s", headReq? "HEAD":"GET"); + NMLOG_INFO("curlopt ipversion = whatever reqtyp = %s", headReq? "HEAD":"GET"); } if(curlVerboseEnabled()) curl_easy_setopt(curl_easy_handle, CURLOPT_VERBOSE, 1L); @@ -503,15 +503,17 @@ namespace WPEFramework void ConnectivityMonitor::notifyInternetStatusChangedEvent(nsm_internetState newInternetState) { + static Exchange::INetworkManager::InternetStatus oldState = Exchange::INetworkManager::InternetStatus::INTERNET_UNKNOWN; if(_instance != nullptr) { - Exchange::INetworkManager::InternetStatus oldState = static_cast(gInternetState.load()); + NMLOG_INFO("notify internet state %s", getInternetStateString(newInternetState)); Exchange::INetworkManager::InternetStatus newState = static_cast(newInternetState); _instance->ReportInternetStatusChange(oldState , newState); gInternetState = newInternetState; + oldState = newState; // 'gInternetState' not exactly previous state, it may change to unknow when interface changed } else - NMLOG_WARNING("NetworkManagerImplementation Instance NULL notifyInternetStatusChange failed."); + NMLOG_FATAL("NetworkManagerImplementation Instance NULL notifyInternetStatusChange failed."); } void ConnectivityMonitor::continuousMonitorFunction() @@ -524,6 +526,22 @@ namespace WPEFramework do { + if(ginterfaceStatus == false) + { + NMLOG_DEBUG("no interface connected; no ccm check"); + gIpv4InternetState = NO_INTERNET; + gIpv6InternetState = NO_INTERNET; + std::unique_lock lock(connMutex); + cvContinuousMonitor.wait_for(lock, std::chrono::seconds(continuousMonitorTimeout.load())); + continue; + } + else + { + gIpv4InternetState = UNKNOWN; + gIpv6InternetState = UNKNOWN; + ipResolveTyp = NSM_IPRESOLVE_WHATEVER; + } + if(doConnectivityMonitor) { NMLOG_DEBUG("connectivity monitor running so skiping ccm check"); @@ -603,7 +621,6 @@ namespace WPEFramework if(gInternetState != currentInternetState) { - NMLOG_INFO("Internet state changed to %s", getInternetStateString(currentInternetState)); /* Notify Internet state change */ notifyInternetStatusChangedEvent(currentInternetState); } @@ -702,7 +719,6 @@ namespace WPEFramework if(gInternetState != currentInternetState || notifyNow) { notifyNow = false; - NMLOG_INFO("notify internet state %s", getInternetStateString(currentInternetState)); notifyInternetStatusChangedEvent(currentInternetState); }