mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Implement a switch for 0.7 compatibility
This commit is contained in:
parent
10c484344e
commit
da68923ac3
|
@ -2115,7 +2115,8 @@ void CServer::PumpNetwork()
|
|||
continue;
|
||||
}
|
||||
|
||||
if(ResponseToken != NET_SECURITY_TOKEN_UNKNOWN && m_RegSixup.RegisterProcessPacket(&Packet, ResponseToken))
|
||||
if(ResponseToken != NET_SECURITY_TOKEN_UNKNOWN && g_Config.m_SvSixup &&
|
||||
m_RegSixup.RegisterProcessPacket(&Packet, ResponseToken))
|
||||
continue;
|
||||
if(ResponseToken == NET_SECURITY_TOKEN_UNKNOWN && m_Register.RegisterProcessPacket(&Packet))
|
||||
continue;
|
||||
|
@ -2139,7 +2140,7 @@ void CServer::PumpNetwork()
|
|||
{
|
||||
Type = SERVERINFO_64_LEGACY;
|
||||
}
|
||||
if(Type == SERVERINFO_VANILLA && ResponseToken != NET_SECURITY_TOKEN_UNKNOWN)
|
||||
if(Type == SERVERINFO_VANILLA && ResponseToken != NET_SECURITY_TOKEN_UNKNOWN && g_Config.m_SvSixup)
|
||||
{
|
||||
CUnpacker Unpacker;
|
||||
Unpacker.Reset((unsigned char*)Packet.m_pData+sizeof(SERVERBROWSE_GETINFO), Packet.m_DataSize-sizeof(SERVERBROWSE_GETINFO));
|
||||
|
@ -2480,7 +2481,8 @@ int CServer::Run()
|
|||
|
||||
// master server stuff
|
||||
m_Register.RegisterUpdate(m_NetServer.NetType());
|
||||
m_RegSixup.RegisterUpdate(m_NetServer.NetType());
|
||||
if(g_Config.m_SvSixup)
|
||||
m_RegSixup.RegisterUpdate(m_NetServer.NetType());
|
||||
|
||||
if(m_ServerInfoNeedsUpdate)
|
||||
UpdateServerInfo();
|
||||
|
|
|
@ -145,6 +145,7 @@ MACRO_CONFIG_INT(SvPlayerDemoRecord, sv_player_demo_record, 0, 0, 1, CFGFLAG_SER
|
|||
MACRO_CONFIG_INT(SvDemoChat, sv_demo_chat, 0, 0, 1, CFGFLAG_SERVER, "Record chat for demos")
|
||||
MACRO_CONFIG_INT(SvServerInfoPerSecond, sv_server_info_per_second, 50, 0, 10000, CFGFLAG_SERVER, "Maximum number of complete server info responses that are sent out per second (0 for no limit)")
|
||||
MACRO_CONFIG_INT(SvVanConnPerSecond, sv_van_conn_per_second, 10, 0, 10000, CFGFLAG_SERVER, "Antispoof specific ratelimit (0 for no limit)")
|
||||
MACRO_CONFIG_INT(SvSixup, sv_sixup, 1, 0, 1, CFGFLAG_SERVER, "Enable sixup connections")
|
||||
|
||||
MACRO_CONFIG_STR(EcBindaddr, ec_bindaddr, 128, "localhost", CFGFLAG_ECON, "Address to bind the external console to. Anything but 'localhost' is dangerous")
|
||||
MACRO_CONFIG_INT(EcPort, ec_port, 0, 0, 0, CFGFLAG_ECON, "Port to use for the external console")
|
||||
|
|
|
@ -216,6 +216,13 @@ bool CNetServer::Connlimit(NETADDR Addr)
|
|||
|
||||
int CNetServer::TryAcceptClient(NETADDR &Addr, SECURITY_TOKEN SecurityToken, bool VanillaAuth, bool Sixup, SECURITY_TOKEN Token)
|
||||
{
|
||||
if(Sixup && !g_Config.m_SvSixup)
|
||||
{
|
||||
const char Msg[] = "0.7 connections are not accepted at this time";
|
||||
CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CLOSE, Msg, sizeof(Msg), SecurityToken, Sixup);
|
||||
return -1; // failed to add client?
|
||||
}
|
||||
|
||||
if (Connlimit(Addr))
|
||||
{
|
||||
const char Msg[] = "Too many connections in a short time";
|
||||
|
|
Loading…
Reference in a new issue