diff --git a/src/mapport.cpp b/src/mapport.cpp --- a/src/mapport.cpp +++ b/src/mapport.cpp @@ -35,8 +35,8 @@ #include #ifdef USE_UPNP -static CThreadInterrupt g_upnp_interrupt; -static std::thread g_upnp_thread; +static CThreadInterrupt g_mapport_interrupt; +static std::thread g_mapport_thread; static std::atomic_uint g_mapport_target_proto{MapPortProtoFlag::NONE}; using namespace std::chrono_literals; @@ -76,7 +76,7 @@ if (LookupHost(externalIPAddress, resolved, false)) { LogPrintf("UPnP: ExternalIPAddress = %s\n", resolved.ToString()); - AddLocal(resolved, LOCAL_UPNP); + AddLocal(resolved, LOCAL_MAPPED); } } else { LogPrintf("UPnP: GetExternalIPAddress failed.\n"); @@ -101,8 +101,8 @@ ret = true; LogPrintf("UPnP Port Mapping successful.\n"); } - } while (g_upnp_interrupt.sleep_for(PORT_MAPPING_REANNOUNCE_PERIOD)); - g_upnp_interrupt.reset(); + } while (g_mapport_interrupt.sleep_for(PORT_MAPPING_REANNOUNCE_PERIOD)); + g_mapport_interrupt.reset(); r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0); @@ -127,13 +127,14 @@ if (ProcessUpnp()) { return; } - } while (g_upnp_interrupt.sleep_for(PORT_MAPPING_RETRY_PERIOD)); + } while (g_mapport_interrupt.sleep_for(PORT_MAPPING_RETRY_PERIOD)); } void StartThreadMapPort() { - if (!g_upnp_thread.joinable()) { - assert(!g_upnp_interrupt); - g_upnp_thread = std::thread(&util::TraceThread, "upnp", &ThreadMapPort); + if (!g_mapport_thread.joinable()) { + assert(!g_mapport_interrupt); + g_mapport_thread = + std::thread(&util::TraceThread, "mapport", &ThreadMapPort); } } @@ -160,15 +161,15 @@ } void InterruptMapPort() { - if (g_upnp_thread.joinable()) { - g_upnp_interrupt(); + if (g_mapport_thread.joinable()) { + g_mapport_interrupt(); } } void StopMapPort() { - if (g_upnp_thread.joinable()) { - g_upnp_thread.join(); - g_upnp_interrupt.reset(); + if (g_mapport_thread.joinable()) { + g_mapport_thread.join(); + g_mapport_interrupt.reset(); } } diff --git a/src/net.h b/src/net.h --- a/src/net.h +++ b/src/net.h @@ -228,7 +228,7 @@ // address explicit bound to LOCAL_BIND, // address reported by UPnP - LOCAL_UPNP, + LOCAL_MAPPED, // address explicitly specified (-externalip=) LOCAL_MANUAL,