mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-02 19:26:41 +00:00
Merge branch 'winroute' into dev
This commit is contained in:
commit
dbd577c6b0
@ -640,7 +640,7 @@ WindowsEthernetTap::WindowsEthernetTap(
|
|||||||
if (ConvertInterfaceGuidToLuid(&_deviceGuid,&_deviceLuid) != NO_ERROR)
|
if (ConvertInterfaceGuidToLuid(&_deviceGuid,&_deviceLuid) != NO_ERROR)
|
||||||
throw std::runtime_error("unable to convert device interface GUID to LUID");
|
throw std::runtime_error("unable to convert device interface GUID to LUID");
|
||||||
|
|
||||||
_initialized = true;
|
//_initialized = true;
|
||||||
|
|
||||||
if (friendlyName)
|
if (friendlyName)
|
||||||
setFriendlyName(friendlyName);
|
setFriendlyName(friendlyName);
|
||||||
@ -1007,6 +1007,10 @@ void WindowsEthernetTap::threadMain()
|
|||||||
ReadFile(_tap,tapReadBuf,sizeof(tapReadBuf),NULL,&tapOvlRead);
|
ReadFile(_tap,tapReadBuf,sizeof(tapReadBuf),NULL,&tapOvlRead);
|
||||||
bool writeInProgress = false;
|
bool writeInProgress = false;
|
||||||
ULONGLONG timeOfLastBorkCheck = GetTickCount64();
|
ULONGLONG timeOfLastBorkCheck = GetTickCount64();
|
||||||
|
|
||||||
|
|
||||||
|
_initialized = true;
|
||||||
|
|
||||||
while (_run) {
|
while (_run) {
|
||||||
DWORD waitResult = WaitForMultipleObjectsEx(writeInProgress ? 3 : 2,wait4,FALSE,2500,TRUE);
|
DWORD waitResult = WaitForMultipleObjectsEx(writeInProgress ? 3 : 2,wait4,FALSE,2500,TRUE);
|
||||||
if (!_run) break; // will also break outer while(_run)
|
if (!_run) break; // will also break outer while(_run)
|
||||||
|
@ -110,6 +110,8 @@ public:
|
|||||||
void threadMain()
|
void threadMain()
|
||||||
throw();
|
throw();
|
||||||
|
|
||||||
|
bool isInitialized() const { return _initialized; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NET_IFINDEX _getDeviceIndex(); // throws on failure
|
NET_IFINDEX _getDeviceIndex(); // throws on failure
|
||||||
std::vector<std::string> _getRegistryIPv4Value(const char *regKey);
|
std::vector<std::string> _getRegistryIPv4Value(const char *regKey);
|
||||||
|
@ -1666,6 +1666,16 @@ public:
|
|||||||
case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_CONFIG_UPDATE:
|
case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_CONFIG_UPDATE:
|
||||||
memcpy(&(n.config),nwc,sizeof(ZT_VirtualNetworkConfig));
|
memcpy(&(n.config),nwc,sizeof(ZT_VirtualNetworkConfig));
|
||||||
if (n.tap) { // sanity check
|
if (n.tap) { // sanity check
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
// wait for up to 5 seconds for the WindowsEthernetTap to actually be initialized
|
||||||
|
//
|
||||||
|
// without WindowsEthernetTap::isInitialized() returning true, the won't actually
|
||||||
|
// be online yet and setting managed routes on it will fail.
|
||||||
|
const int MAX_SLEEP_COUNT = 500;
|
||||||
|
for (int i = 0; !n.tap->isInitialized() && i < MAX_SLEEP_COUNT; i++) {
|
||||||
|
Sleep(10);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
syncManagedStuff(n,true,true);
|
syncManagedStuff(n,true,true);
|
||||||
} else {
|
} else {
|
||||||
_nets.erase(nwid);
|
_nets.erase(nwid);
|
||||||
|
Loading…
Reference in New Issue
Block a user