Browse Source

Fix leaving of networks to actually call Network::destroy().

Adam Ierymenko 10 years ago
parent
commit
7a15d8a7e3
2 changed files with 3 additions and 3 deletions
  1. 1 0
      node/Node.cpp
  2. 2 3
      osdep/OSUtils.hpp

+ 1 - 0
node/Node.cpp

@@ -316,6 +316,7 @@ ZT1_ResultCode Node::leave(uint64_t nwid)
 	for(std::vector< std::pair< uint64_t,SharedPtr<Network> > >::const_iterator n(_networks.begin());n!=_networks.end();++n) {
 	for(std::vector< std::pair< uint64_t,SharedPtr<Network> > >::const_iterator n(_networks.begin());n!=_networks.end();++n) {
 		if (n->first != nwid)
 		if (n->first != nwid)
 			newn.push_back(*n);
 			newn.push_back(*n);
+		else n->second->destroy();
 	}
 	}
 	_networks.swap(newn);
 	_networks.swap(newn);
 	return ZT1_RESULT_OK;
 	return ZT1_RESULT_OK;

+ 2 - 3
osdep/OSUtils.hpp

@@ -121,10 +121,10 @@ public:
 
 
 	/**
 	/**
 	 * Set modes on a file to something secure
 	 * Set modes on a file to something secure
-	 * 
+	 *
 	 * This locks a file so that only the owner can access it. What it actually
 	 * This locks a file so that only the owner can access it. What it actually
 	 * does varies by platform.
 	 * does varies by platform.
-	 * 
+	 *
 	 * @param path Path to lock
 	 * @param path Path to lock
 	 * @param isDir True if this is a directory
 	 * @param isDir True if this is a directory
 	 */
 	 */
@@ -252,4 +252,3 @@ private:
 } // namespace ZeroTier
 } // namespace ZeroTier
 
 
 #endif
 #endif
-