Skip to content

Commit 8fb45fc

Browse files
committed
mapport: remove unnecessary 'g_mapport_current' variable
1 parent 1b223cb commit 8fb45fc

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/mapport.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
static CThreadInterrupt g_mapport_interrupt;
2727
static std::thread g_mapport_thread;
2828
static std::atomic_bool g_mapport_enabled{false};
29-
static std::atomic_bool g_mapport_current{false};
3029

3130
using namespace std::chrono_literals;
3231
static constexpr auto PORT_MAPPING_REANNOUNCE_PERIOD{20min};
@@ -130,12 +129,10 @@ static void ThreadMapPort()
130129
ok = false;
131130

132131
if (g_mapport_enabled) {
133-
g_mapport_current = true;
134132
ok = ProcessPCP();
135133
if (ok) continue;
136134
}
137135

138-
g_mapport_current = false;
139136
if (!g_mapport_enabled) {
140137
return;
141138
}
@@ -154,9 +151,9 @@ void StartThreadMapPort()
154151
void StartMapPort(bool enable)
155152
{
156153
g_mapport_enabled = enable;
157-
if (!g_mapport_current && g_mapport_enabled) {
154+
if (g_mapport_enabled) {
158155
StartThreadMapPort();
159-
} else if (g_mapport_current && !g_mapport_enabled) {
156+
} else {
160157
InterruptMapPort();
161158
StopMapPort();
162159
}

0 commit comments

Comments
 (0)