summaryrefslogtreecommitdiff
path: root/osnet/WindowsEthernetTapFactory.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@zerotier.com>2014-08-21 17:49:05 -0700
committerAdam Ierymenko <adam.ierymenko@zerotier.com>2014-08-21 17:49:05 -0700
commitde4e29288d30183ca78a5e0878431ed47fa58b8f (patch)
tree5b944e4176ead99473b2457386de315aa87aa405 /osnet/WindowsEthernetTapFactory.cpp
parent44d58ee871c498646213c01d1cd0417c2d537056 (diff)
downloadinfinitytier-de4e29288d30183ca78a5e0878431ed47fa58b8f.tar.gz
infinitytier-de4e29288d30183ca78a5e0878431ed47fa58b8f.zip
Fix for crazy Windows threading bug... repeatedly adding and removing a network now doesn't leave networks in limbo.
Diffstat (limited to 'osnet/WindowsEthernetTapFactory.cpp')
-rw-r--r--osnet/WindowsEthernetTapFactory.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/osnet/WindowsEthernetTapFactory.cpp b/osnet/WindowsEthernetTapFactory.cpp
index 74703077..b2ff422a 100644
--- a/osnet/WindowsEthernetTapFactory.cpp
+++ b/osnet/WindowsEthernetTapFactory.cpp
@@ -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