Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions plugin/NetworkManagerConnectivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,21 +634,15 @@ namespace WPEFramework
return false;
}

string defaultIface = _instance->getDefaultInterface();

if(defaultIface.empty())
{
NMLOG_WARNING("default interface not set");
return false;
}

m_notify = true;
m_switchToInitial = true;
m_wakeupMonitoring = true;
m_cmCv.notify_one();

string defaultIface = _instance->getDefaultInterface();
NMLOG_INFO("switching to initial check - eth %s - wlan %s - default interface %s",
_instance->m_ethConnected.load()? "up":"down", _instance->m_wlanConnected.load()? "up":"down", defaultIface.c_str());
_instance->m_ethConnected.load()? "up":"down", _instance->m_wlanConnected.load()? "up":"down",
defaultIface.empty() ? "none" : defaultIface.c_str());

return true;
}
Expand Down Expand Up @@ -777,12 +771,24 @@ namespace WPEFramework
if (!m_cmRunning)
break;

// Wait for next interval
std::unique_lock<std::mutex> lock(m_cmMutex);
if (m_cmCv.wait_for(lock, std::chrono::seconds(timeoutInSec), [this] { return m_wakeupMonitoring.load(); }))
// Wait for the next signal. Once the state is fully connected, stay idle until
// a wake-up event indicates the network changed; do not poll every 30 seconds.
if (m_switchToInitial == false && m_InternetState == INTERNET_FULLY_CONNECTED)
{
NMLOG_INFO("connectivity monitor received signal. skipping %d sec interval", timeoutInSec);
std::unique_lock<std::mutex> lock(m_cmMutex);
NMLOG_INFO("ideal thread infinite wait strted while fully connected");
m_cmCv.wait(lock, [this] { return m_wakeupMonitoring.load(); });
m_wakeupMonitoring = false;
NMLOG_INFO("connectivity monitor received signal. skipping infinite sec interval");
}
else
{
std::unique_lock<std::mutex> lock(m_cmMutex);
if (m_cmCv.wait_for(lock, std::chrono::seconds(timeoutInSec), [this] { return m_wakeupMonitoring.load(); }))
{
NMLOG_INFO("connectivity monitor received signal. skipping %d sec interval", timeoutInSec);
m_wakeupMonitoring = false;
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions plugin/NetworkManagerImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,8 @@ namespace WPEFramework
{
NMLOG_INFO("OnPowerModePreChange: waking from DeepSleep — WiFi was not connected or was already down before sleep, skipping reconnect");
}
// DeepSleep → Standby wake (Network Standby OFF): re-verify connectivity so internet status is re-published.
connectivityMonitor.switchToInitialCheck();
}
sendAck();
}
Expand Down Expand Up @@ -1518,6 +1520,8 @@ namespace WPEFramework
NMLOG_ERROR("OnPowerModeChanged: ReacquireDHCPLease(eth0) failed");
}
}
// DeepSleep → Standby wake (Network Standby ON): re-verify connectivity so internet status is re-published.
connectivityMonitor.switchToInitialCheck();
}
}

Expand Down
Loading