Fix for crazy Windows threading bug... repeatedly adding and removing a network now doesn't leave networks in limbo.

This commit is contained in:
Adam Ierymenko 2014-08-21 17:49:05 -07:00
parent 44d58ee871
commit de4e29288d
8 changed files with 166 additions and 169 deletions

View file

@ -75,6 +75,9 @@ EthernetTap *WindowsEthernetTapFactory::open(
void WindowsEthernetTapFactory::close(EthernetTap *tap,bool destroyPersistentDevices)
{
if (!tap)
return;
std::string instanceId(((WindowsEthernetTap *)tap)->instanceId());
Mutex::Lock _l(_devices_m);
@ -120,20 +123,8 @@ void WindowsEthernetTapFactory::destroyAllPersistentTapDevices(const char *pathT
dataLen = sizeof(data);
if (RegGetValueA(nwAdapters,subkeyName,"DeviceInstanceID",RRF_RT_ANY,&type,(PVOID)data,&dataLen) == ERROR_SUCCESS)
instanceIdPath.assign(data,dataLen);
if (instanceIdPath.length() != 0) {
if (instanceIdPath.length() != 0)
instanceIdPathsToRemove.insert(instanceIdPath);
/*
type = 0;
dataLen = sizeof(data);
if (RegGetValueA(nwAdapters,subkeyName,"_ZeroTierTapIdentifier",RRF_RT_ANY,&type,(PVOID)data,&dataLen) == ERROR_SUCCESS) {
if (dataLen <= 0) {
instanceIdPathsToRemove.insert(instanceIdPath);
} else {
instanceIdPathsToRemove.insert(instanceIdPath);
}
}
*/
}
}
}
} else break; // end of list or failure