Execute shutdown on port mapping thread
This commit is contained in:
		
					parent
					
						
							
								039903c82d
							
						
					
				
			
			
				commit
				
					
						5f3337b53d
					
				
			
		
					 2 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
					@ -66,6 +66,11 @@ void nano::port_mapping::stop ()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		thread.join ();
 | 
							thread.join ();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void nano::port_mapping::shutdown ()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						node.logger.debug (nano::log::type::upnp, "UPnP shutdown...");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	nano::lock_guard<nano::mutex> guard_l (mutex);
 | 
						nano::lock_guard<nano::mutex> guard_l (mutex);
 | 
				
			||||||
	for (auto & protocol : protocols | boost::adaptors::filtered ([] (auto const & p) { return p.enabled; }))
 | 
						for (auto & protocol : protocols | boost::adaptors::filtered ([] (auto const & p) { return p.enabled; }))
 | 
				
			||||||
| 
						 | 
					@ -308,6 +313,10 @@ void nano::port_mapping::run ()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		condition.wait_for (lock, node.network_params.portmapping.health_check_period, [this] { return stopped.load (); });
 | 
							condition.wait_for (lock, node.network_params.portmapping.health_check_period, [this] { return stopped.load (); });
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						lock.unlock ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						shutdown ();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,12 +56,14 @@ public:
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	void run ();
 | 
						void run ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void shutdown ();
 | 
				
			||||||
	/** Add port mappings for the node port (not RPC). Refresh when the lease ends. */
 | 
						/** Add port mappings for the node port (not RPC). Refresh when the lease ends. */
 | 
				
			||||||
	void refresh_mapping ();
 | 
						void refresh_mapping ();
 | 
				
			||||||
	/** Check occasionally to refresh in case router loses mapping */
 | 
						/** Check occasionally to refresh in case router loses mapping */
 | 
				
			||||||
	void check_mapping ();
 | 
						void check_mapping ();
 | 
				
			||||||
	/** Returns false if mapping still exists */
 | 
						/** Returns false if mapping still exists */
 | 
				
			||||||
	bool check_lost_or_old_mapping ();
 | 
						bool check_lost_or_old_mapping ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	std::string get_config_port (std::string const &);
 | 
						std::string get_config_port (std::string const &);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private: // Dependencies
 | 
					private: // Dependencies
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue