Skip to content

Commit

Permalink
refactor: Replace magic number with named constant
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto authored and Fuzzbawls committed Jun 14, 2021
1 parent c481f62 commit 7532090
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mapport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ static_assert(MINIUPNPC_API_VERSION >= 10, "miniUPnPc API version >= 10 assumed"
#ifdef USE_UPNP
static CThreadInterrupt g_upnp_interrupt;
static std::thread g_upnp_thread;

static constexpr auto PORT_MAPPING_REANNOUNCE_PERIOD = std::chrono::minutes(20);

void ThreadMapPort()
{
std::string port = strprintf("%u", GetListenPort());
Expand Down Expand Up @@ -84,7 +87,7 @@ void ThreadMapPort()
} else {
LogPrintf("UPnP Port Mapping successful.\n");
}
} while(g_upnp_interrupt.sleep_for(std::chrono::minutes(20)));
} while(g_upnp_interrupt.sleep_for(PORT_MAPPING_REANNOUNCE_PERIOD));

r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0);
LogPrintf("UPNP_DeletePortMapping() returned: %d\n", r);
Expand Down

0 comments on commit 7532090

Please sign in to comment.