Implement a switch for 0.7 compatibility

This commit is contained in:
Learath 2020-06-19 22:08:16 +03:00
parent 10c484344e
commit da68923ac3
3 changed files with 13 additions and 3 deletions

View file

@ -2115,7 +2115,8 @@ void CServer::PumpNetwork()
continue; 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; continue;
if(ResponseToken == NET_SECURITY_TOKEN_UNKNOWN && m_Register.RegisterProcessPacket(&Packet)) if(ResponseToken == NET_SECURITY_TOKEN_UNKNOWN && m_Register.RegisterProcessPacket(&Packet))
continue; continue;
@ -2139,7 +2140,7 @@ void CServer::PumpNetwork()
{ {
Type = SERVERINFO_64_LEGACY; 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; CUnpacker Unpacker;
Unpacker.Reset((unsigned char*)Packet.m_pData+sizeof(SERVERBROWSE_GETINFO), Packet.m_DataSize-sizeof(SERVERBROWSE_GETINFO)); Unpacker.Reset((unsigned char*)Packet.m_pData+sizeof(SERVERBROWSE_GETINFO), Packet.m_DataSize-sizeof(SERVERBROWSE_GETINFO));
@ -2480,6 +2481,7 @@ int CServer::Run()
// master server stuff // master server stuff
m_Register.RegisterUpdate(m_NetServer.NetType()); m_Register.RegisterUpdate(m_NetServer.NetType());
if(g_Config.m_SvSixup)
m_RegSixup.RegisterUpdate(m_NetServer.NetType()); m_RegSixup.RegisterUpdate(m_NetServer.NetType());
if(m_ServerInfoNeedsUpdate) if(m_ServerInfoNeedsUpdate)

View file

@ -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(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(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(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_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") MACRO_CONFIG_INT(EcPort, ec_port, 0, 0, 0, CFGFLAG_ECON, "Port to use for the external console")

View file

@ -216,6 +216,13 @@ bool CNetServer::Connlimit(NETADDR Addr)
int CNetServer::TryAcceptClient(NETADDR &Addr, SECURITY_TOKEN SecurityToken, bool VanillaAuth, bool Sixup, SECURITY_TOKEN Token) 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)) if (Connlimit(Addr))
{ {
const char Msg[] = "Too many connections in a short time"; const char Msg[] = "Too many connections in a short time";