diff --git a/nano/node/portmapping.cpp b/nano/node/portmapping.cpp index b70b8edd9c..0dd1605bda 100644 --- a/nano/node/portmapping.cpp +++ b/nano/node/portmapping.cpp @@ -66,6 +66,11 @@ void nano::port_mapping::stop () { thread.join (); } +} + +void nano::port_mapping::shutdown () +{ + node.logger.debug (nano::log::type::upnp, "UPnP shutdown..."); nano::lock_guard guard_l (mutex); 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 (); }); } + + lock.unlock (); + + shutdown (); } /* diff --git a/nano/node/portmapping.hpp b/nano/node/portmapping.hpp index 6e47dd1395..cc542896ad 100644 --- a/nano/node/portmapping.hpp +++ b/nano/node/portmapping.hpp @@ -56,12 +56,14 @@ class port_mapping private: void run (); + void shutdown (); /** Add port mappings for the node port (not RPC). Refresh when the lease ends. */ void refresh_mapping (); /** Check occasionally to refresh in case router loses mapping */ void check_mapping (); /** Returns false if mapping still exists */ bool check_lost_or_old_mapping (); + std::string get_config_port (std::string const &); private: // Dependencies