diff options
| -rw-r--r-- | CHANGELOG.md | 5 | ||||
| -rw-r--r-- | windows/winnet/src/extras/loader/loader.cpp | 8 | ||||
| -rw-r--r-- | windows/winnet/src/winnet/netmonitor.cpp | 13 | ||||
| -rw-r--r-- | windows/winnet/src/winnet/winnet.cpp | 4 |
4 files changed, 18 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index dd98d5d9c0..d724488824 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,11 @@ Line wrap the file at 100 chars. Th #### Windows - Add migration logic to restore lost settings after major Windows update. +### Fixed + +#### Windows +- Adjust network interface checks in offline detection logic. + ## [2019.5] - 2019-06-17 ### Added - Add Norwegian translations diff --git a/windows/winnet/src/extras/loader/loader.cpp b/windows/winnet/src/extras/loader/loader.cpp index 4a09a890eb..648c16f37b 100644 --- a/windows/winnet/src/extras/loader/loader.cpp +++ b/windows/winnet/src/extras/loader/loader.cpp @@ -2,7 +2,7 @@ #include "../../winnet/winnet.h" #include <iostream> -void __stdcall ConnectivityChanged(uint8_t connected) +void __stdcall ConnectivityChanged(bool connected, void *) { std::wcout << (0 != connected? L"Connected" : L"NOT connected") << std::endl; } @@ -27,12 +27,12 @@ int main() // } //}; - uint8_t currentConnectivity = 0; + bool currentConnectivity = 0; - const auto status = WinNet_ActivateConnectivityMonitor(ConnectivityChanged, ¤tConnectivity, nullptr, nullptr); + const auto status = WinNet_ActivateConnectivityMonitor(ConnectivityChanged, nullptr, ¤tConnectivity, nullptr, nullptr); std::wcout << L"Current connectivity: " - << (0 != currentConnectivity ? L"Connected" : L"NOT connected") << std::endl; + << (currentConnectivity ? L"Connected" : L"NOT connected") << std::endl; _getwch(); diff --git a/windows/winnet/src/winnet/netmonitor.cpp b/windows/winnet/src/winnet/netmonitor.cpp index 4de068f9cd..a6c2903397 100644 --- a/windows/winnet/src/winnet/netmonitor.cpp +++ b/windows/winnet/src/winnet/netmonitor.cpp @@ -18,7 +18,8 @@ bool ValidInterfaceType(const MIB_IF_ROW2 &iface) } } - if (FALSE == iface.InterfaceAndOperStatusFlags.ConnectorPresent + if (FALSE != iface.InterfaceAndOperStatusFlags.FilterInterface + || 0 == iface.PhysicalAddressLength || FALSE != iface.InterfaceAndOperStatusFlags.EndPointInterface) { return false; @@ -85,17 +86,17 @@ void NetMonitor::AddCacheEntry(Cache &cache, const MIB_IF_ROW2 &iface) { CacheEntry e; - if (false == ValidInterfaceType(iface)) + if (ValidInterfaceType(iface)) { e.luid = iface.InterfaceLuid.Value; - e.valid = false; - e.connected = false; + e.valid = true; + e.connected = (MediaConnectStateConnected == iface.MediaConnectState); } else { e.luid = iface.InterfaceLuid.Value; - e.valid = true; - e.connected = (MediaConnectStateConnected == iface.MediaConnectState); + e.valid = false; + e.connected = false; } cache.insert(std::make_pair(e.luid, e)); diff --git a/windows/winnet/src/winnet/winnet.cpp b/windows/winnet/src/winnet/winnet.cpp index aa23adbc8d..2465ec667b 100644 --- a/windows/winnet/src/winnet/winnet.cpp +++ b/windows/winnet/src/winnet/winnet.cpp @@ -215,8 +215,8 @@ WINNET_LINKAGE WINNET_CC_STATUS
WINNET_API
WinNet_CheckConnectivity(
- WinNetErrorSink errorSink, - void *errorSinkContext + WinNetErrorSink errorSink,
+ void *errorSinkContext
)
{
try
|
