Add option for official server to disable stun at all
This commit is contained in:
parent
d89c65b0c9
commit
4ef0c4e03c
@ -723,6 +723,10 @@ namespace UserConfigParams
|
|||||||
PARAM_PREFIX IntUserConfigParam m_server_max_players
|
PARAM_PREFIX IntUserConfigParam m_server_max_players
|
||||||
PARAM_DEFAULT(IntUserConfigParam(12, "server_max_players",
|
PARAM_DEFAULT(IntUserConfigParam(12, "server_max_players",
|
||||||
&m_network_group, "Maximum number of players on the server."));
|
&m_network_group, "Maximum number of players on the server."));
|
||||||
|
PARAM_PREFIX BoolUserConfigParam m_firewalled_server
|
||||||
|
PARAM_DEFAULT(BoolUserConfigParam(true, "firewalled-server",
|
||||||
|
&m_network_group, "Disable it to turn off all stun related code "
|
||||||
|
"in server, for official server hosting use only."));
|
||||||
|
|
||||||
PARAM_PREFIX StringToUIntUserConfigParam m_server_ban_list
|
PARAM_PREFIX StringToUIntUserConfigParam m_server_ban_list
|
||||||
PARAM_DEFAULT(StringToUIntUserConfigParam("server_ban_list",
|
PARAM_DEFAULT(StringToUIntUserConfigParam("server_ban_list",
|
||||||
|
@ -667,9 +667,12 @@ void ServerLobby::checkIncomingConnectionRequests()
|
|||||||
|
|
||||||
// Keep the port open, it can be sent to anywhere as we will send to the
|
// Keep the port open, it can be sent to anywhere as we will send to the
|
||||||
// correct peer later in ConnectToPeer.
|
// correct peer later in ConnectToPeer.
|
||||||
|
if (UserConfigParams::m_firewalled_server)
|
||||||
|
{
|
||||||
BareNetworkString data;
|
BareNetworkString data;
|
||||||
data.addUInt8(0);
|
data.addUInt8(0);
|
||||||
STKHost::get()->sendRawPacket(data, STKHost::get()->getStunAddress());
|
STKHost::get()->sendRawPacket(data, STKHost::get()->getStunAddress());
|
||||||
|
}
|
||||||
|
|
||||||
// Now poll the stk server
|
// Now poll the stk server
|
||||||
last_poll_time = StkTime::getRealTime();
|
last_poll_time = StkTime::getRealTime();
|
||||||
@ -696,6 +699,10 @@ void ServerLobby::checkIncomingConnectionRequests()
|
|||||||
const XMLNode * users_xml = result->getNode("users");
|
const XMLNode * users_xml = result->getNode("users");
|
||||||
std::map<uint32_t, std::tuple<std::string, std::string,
|
std::map<uint32_t, std::tuple<std::string, std::string,
|
||||||
irr::core::stringw, bool> > keys;
|
irr::core::stringw, bool> > keys;
|
||||||
|
auto sl = m_server_lobby.lock();
|
||||||
|
if (!sl || sl->m_state.load() != ACCEPTING_CLIENTS)
|
||||||
|
return;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < users_xml->getNumNodes(); i++)
|
for (unsigned int i = 0; i < users_xml->getNumNodes(); i++)
|
||||||
{
|
{
|
||||||
uint32_t addr, id;
|
uint32_t addr, id;
|
||||||
@ -707,11 +714,13 @@ void ServerLobby::checkIncomingConnectionRequests()
|
|||||||
users_xml->getNode(i)->get("iv", &std::get<1>(keys[id]));
|
users_xml->getNode(i)->get("iv", &std::get<1>(keys[id]));
|
||||||
users_xml->getNode(i)->get("username", &std::get<2>(keys[id]));
|
users_xml->getNode(i)->get("username", &std::get<2>(keys[id]));
|
||||||
std::get<3>(keys[id]) = false;
|
std::get<3>(keys[id]) = false;
|
||||||
std::make_shared<ConnectToPeer>(TransportAddress(addr, port))
|
if (UserConfigParams::m_firewalled_server)
|
||||||
->requestStart();
|
{
|
||||||
|
std::make_shared<ConnectToPeer>
|
||||||
|
(TransportAddress(addr, port))->requestStart();
|
||||||
}
|
}
|
||||||
auto sl = m_server_lobby.lock();
|
}
|
||||||
if (keys.empty() || !sl || sl->m_state.load() != ACCEPTING_CLIENTS)
|
if (keys.empty())
|
||||||
return;
|
return;
|
||||||
sl->addAndReplaceKeys(keys);
|
sl->addAndReplaceKeys(keys);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user