mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
mapport: remove unnecessary 'g_mapport_current' variable
This commit is contained in:
parent
1b223cb19b
commit
8fb45fcda0
1 changed files with 2 additions and 5 deletions
|
@ -26,7 +26,6 @@
|
||||||
static CThreadInterrupt g_mapport_interrupt;
|
static CThreadInterrupt g_mapport_interrupt;
|
||||||
static std::thread g_mapport_thread;
|
static std::thread g_mapport_thread;
|
||||||
static std::atomic_bool g_mapport_enabled{false};
|
static std::atomic_bool g_mapport_enabled{false};
|
||||||
static std::atomic_bool g_mapport_current{false};
|
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
static constexpr auto PORT_MAPPING_REANNOUNCE_PERIOD{20min};
|
static constexpr auto PORT_MAPPING_REANNOUNCE_PERIOD{20min};
|
||||||
|
@ -130,12 +129,10 @@ static void ThreadMapPort()
|
||||||
ok = false;
|
ok = false;
|
||||||
|
|
||||||
if (g_mapport_enabled) {
|
if (g_mapport_enabled) {
|
||||||
g_mapport_current = true;
|
|
||||||
ok = ProcessPCP();
|
ok = ProcessPCP();
|
||||||
if (ok) continue;
|
if (ok) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_mapport_current = false;
|
|
||||||
if (!g_mapport_enabled) {
|
if (!g_mapport_enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -154,9 +151,9 @@ void StartThreadMapPort()
|
||||||
void StartMapPort(bool enable)
|
void StartMapPort(bool enable)
|
||||||
{
|
{
|
||||||
g_mapport_enabled = enable;
|
g_mapport_enabled = enable;
|
||||||
if (!g_mapport_current && g_mapport_enabled) {
|
if (g_mapport_enabled) {
|
||||||
StartThreadMapPort();
|
StartThreadMapPort();
|
||||||
} else if (g_mapport_current && !g_mapport_enabled) {
|
} else {
|
||||||
InterruptMapPort();
|
InterruptMapPort();
|
||||||
StopMapPort();
|
StopMapPort();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue