From e2b1a7157e3ba7b3cb342582acbdeb22033d7b84 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Thu, 5 Jan 2017 11:43:26 -0800 Subject: Potential fix for routing issue on Windows Move setting _initialized = true until after WindowsEthernetTap::threadMain() has actually created and brought up the adapter. Also in OneService::nodeVirtualNetworkConfigFunction(), wait up to 5 seconds for WindowsEthernatTap::isInitialized() to return true before attempting to configure the interface and managed routes. Without this, the adapter doesnt actually exist yet when trying to add routes --- service/OneService.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'service') diff --git a/service/OneService.cpp b/service/OneService.cpp index 3a7edacb..96b3a960 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -1666,6 +1666,16 @@ public: case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_CONFIG_UPDATE: memcpy(&(n.config),nwc,sizeof(ZT_VirtualNetworkConfig)); 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); } else { _nets.erase(nwid); -- cgit v1.2.3