File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change 26
26
static CThreadInterrupt g_mapport_interrupt;
27
27
static std::thread g_mapport_thread;
28
28
static std::atomic_bool g_mapport_enabled{false };
29
- static std::atomic_bool g_mapport_current{false };
30
29
31
30
using namespace std ::chrono_literals;
32
31
static constexpr auto PORT_MAPPING_REANNOUNCE_PERIOD{20min};
@@ -130,12 +129,10 @@ static void ThreadMapPort()
130
129
ok = false ;
131
130
132
131
if (g_mapport_enabled) {
133
- g_mapport_current = true ;
134
132
ok = ProcessPCP ();
135
133
if (ok) continue ;
136
134
}
137
135
138
- g_mapport_current = false ;
139
136
if (!g_mapport_enabled) {
140
137
return ;
141
138
}
@@ -154,9 +151,9 @@ void StartThreadMapPort()
154
151
void StartMapPort (bool enable)
155
152
{
156
153
g_mapport_enabled = enable;
157
- if (!g_mapport_current && g_mapport_enabled) {
154
+ if (g_mapport_enabled) {
158
155
StartThreadMapPort ();
159
- } else if (g_mapport_current && !g_mapport_enabled) {
156
+ } else {
160
157
InterruptMapPort ();
161
158
StopMapPort ();
162
159
}
You can’t perform that action at this time.
0 commit comments