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
This commit is contained in:
Grant Limberg 2017-01-05 11:43:26 -08:00
parent aaf69d1aff
commit e2b1a7157e
3 changed files with 20 additions and 1 deletions

View file

@ -640,7 +640,7 @@ WindowsEthernetTap::WindowsEthernetTap(
if (ConvertInterfaceGuidToLuid(&_deviceGuid,&_deviceLuid) != NO_ERROR)
throw std::runtime_error("unable to convert device interface GUID to LUID");
_initialized = true;
//_initialized = true;
if (friendlyName)
setFriendlyName(friendlyName);
@ -1007,6 +1007,10 @@ void WindowsEthernetTap::threadMain()
ReadFile(_tap,tapReadBuf,sizeof(tapReadBuf),NULL,&tapOvlRead);
bool writeInProgress = false;
ULONGLONG timeOfLastBorkCheck = GetTickCount64();
_initialized = true;
while (_run) {
DWORD waitResult = WaitForMultipleObjectsEx(writeInProgress ? 3 : 2,wait4,FALSE,2500,TRUE);
if (!_run) break; // will also break outer while(_run)