aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-02-23 00:57:47 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-01-07 18:07:08 +0200
commitcf151cc68c95a8943e43e3fa4061e176262779e7 (patch)
treeacae4c5db77ebd79648dad54806f3b02caf8e6d9
parent4e91b1e24d96e0cdccdd2a3ed034413f3ba6bae6 (diff)
scripted-diff: Rename UPnP stuff
-BEGIN VERIFY SCRIPT- sed -i 's/g_upnp_interrupt/g_mapport_interrupt/' src/mapport.cpp sed -i 's/if(g_upnp_thread/if (g_mapport_thread/' src/mapport.cpp sed -i 's/g_upnp_thread/g_mapport_thread/' src/mapport.cpp sed -i 's/LOCAL_UPNP/LOCAL_MAPPED/' src/mapport.cpp sed -i 's/\bupnp\b/mapport/' src/mapport.cpp sed -i 's/LOCAL_UPNP, /LOCAL_MAPPED,/' src/net.h -END VERIFY SCRIPT-
-rw-r--r--src/mapport.cpp28
-rw-r--r--src/net.h2
2 files changed, 15 insertions, 15 deletions
diff --git a/src/mapport.cpp b/src/mapport.cpp
index 5091e9f44d..5f0aeb5e40 100644
--- a/src/mapport.cpp
+++ b/src/mapport.cpp
@@ -33,8 +33,8 @@ static_assert(MINIUPNPC_API_VERSION >= 10, "miniUPnPc API version >= 10 assumed"
#include <thread>
#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;
@@ -74,7 +74,7 @@ static bool ProcessUpnp()
CNetAddr resolved;
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");
@@ -95,8 +95,8 @@ static bool ProcessUpnp()
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);
LogPrintf("UPNP_DeletePortMapping() returned: %d\n", r);
@@ -116,14 +116,14 @@ static void ThreadMapPort()
{
do {
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((std::bind(&TraceThread<void (*)()>, "upnp", &ThreadMapPort)));
+ if (!g_mapport_thread.joinable()) {
+ assert(!g_mapport_interrupt);
+ g_mapport_thread = std::thread((std::bind(&TraceThread<void (*)()>, "mapport", &ThreadMapPort)));
}
}
@@ -154,16 +154,16 @@ void StartMapPort(bool use_upnp)
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
index 6827c6897f..2f4576016d 100644
--- a/src/net.h
+++ b/src/net.h
@@ -182,7 +182,7 @@ enum
LOCAL_NONE, // unknown
LOCAL_IF, // address a local interface listens on
LOCAL_BIND, // address explicit bound to
- LOCAL_UPNP, // address reported by UPnP
+ LOCAL_MAPPED, // address reported by UPnP
LOCAL_MANUAL, // address explicitly specified (-externalip=)
LOCAL_MAX