mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Remove support for legacy 64 player info protocol
It was only being used for "Leak IP" favorites and LAN servers. Since KoG has upgraded to latest DDNet, there aren't much servers left that don't understand the new 64 player info protocol. Keywords: fstd, dtsf
This commit is contained in:
parent
a97a597592
commit
150485e3b0
|
@ -1345,8 +1345,6 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket)
|
||||||
int Type = -1;
|
int Type = -1;
|
||||||
if(mem_comp(pPacket->m_pData, SERVERBROWSE_INFO, sizeof(SERVERBROWSE_INFO)) == 0)
|
if(mem_comp(pPacket->m_pData, SERVERBROWSE_INFO, sizeof(SERVERBROWSE_INFO)) == 0)
|
||||||
Type = SERVERINFO_VANILLA;
|
Type = SERVERINFO_VANILLA;
|
||||||
else if(mem_comp(pPacket->m_pData, SERVERBROWSE_INFO_64_LEGACY, sizeof(SERVERBROWSE_INFO_64_LEGACY)) == 0)
|
|
||||||
Type = SERVERINFO_64_LEGACY;
|
|
||||||
else if(mem_comp(pPacket->m_pData, SERVERBROWSE_INFO_EXTENDED, sizeof(SERVERBROWSE_INFO_EXTENDED)) == 0)
|
else if(mem_comp(pPacket->m_pData, SERVERBROWSE_INFO_EXTENDED, sizeof(SERVERBROWSE_INFO_EXTENDED)) == 0)
|
||||||
Type = SERVERINFO_EXTENDED;
|
Type = SERVERINFO_EXTENDED;
|
||||||
else if(mem_comp(pPacket->m_pData, SERVERBROWSE_INFO_EXTENDED_MORE, sizeof(SERVERBROWSE_INFO_EXTENDED_MORE)) == 0)
|
else if(mem_comp(pPacket->m_pData, SERVERBROWSE_INFO_EXTENDED_MORE, sizeof(SERVERBROWSE_INFO_EXTENDED_MORE)) == 0)
|
||||||
|
@ -1375,8 +1373,7 @@ void CClient::ProcessServerInfo(int RawType, NETADDR *pFrom, const void *pData,
|
||||||
|
|
||||||
CServerInfo Info = {0};
|
CServerInfo Info = {0};
|
||||||
int SavedType = SavedServerInfoType(RawType);
|
int SavedType = SavedServerInfoType(RawType);
|
||||||
if((SavedType == SERVERINFO_64_LEGACY || SavedType == SERVERINFO_EXTENDED) &&
|
if(SavedType == SERVERINFO_EXTENDED && pEntry && pEntry->m_GotInfo && SavedType == pEntry->m_Info.m_Type)
|
||||||
pEntry && pEntry->m_GotInfo && SavedType == pEntry->m_Info.m_Type)
|
|
||||||
{
|
{
|
||||||
Info = pEntry->m_Info;
|
Info = pEntry->m_Info;
|
||||||
}
|
}
|
||||||
|
@ -1391,7 +1388,6 @@ void CClient::ProcessServerInfo(int RawType, NETADDR *pFrom, const void *pData,
|
||||||
#define GET_STRING(array) str_copy(array, Up.GetString(CUnpacker::SANITIZE_CC | CUnpacker::SKIP_START_WHITESPACES), sizeof(array))
|
#define GET_STRING(array) str_copy(array, Up.GetString(CUnpacker::SANITIZE_CC | CUnpacker::SKIP_START_WHITESPACES), sizeof(array))
|
||||||
#define GET_INT(integer) (integer) = str_toint(Up.GetString())
|
#define GET_INT(integer) (integer) = str_toint(Up.GetString())
|
||||||
|
|
||||||
int Offset = 0; // Only used for SavedType == SERVERINFO_64_LEGACY
|
|
||||||
int Token;
|
int Token;
|
||||||
int PacketNo = 0; // Only used if SavedType == SERVERINFO_EXTENDED
|
int PacketNo = 0; // Only used if SavedType == SERVERINFO_EXTENDED
|
||||||
|
|
||||||
|
@ -1449,13 +1445,6 @@ void CClient::ProcessServerInfo(int RawType, NETADDR *pFrom, const void *pData,
|
||||||
dbg_assert(false, "unknown serverinfo type");
|
dbg_assert(false, "unknown serverinfo type");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SavedType == SERVERINFO_64_LEGACY)
|
|
||||||
Offset = Up.GetInt();
|
|
||||||
|
|
||||||
// Check for valid offset.
|
|
||||||
if(Offset < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(SavedType == SERVERINFO_EXTENDED)
|
if(SavedType == SERVERINFO_EXTENDED)
|
||||||
PacketNo = 0;
|
PacketNo = 0;
|
||||||
}
|
}
|
||||||
|
@ -1478,7 +1467,7 @@ void CClient::ProcessServerInfo(int RawType, NETADDR *pFrom, const void *pData,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IgnoreError = false;
|
bool IgnoreError = false;
|
||||||
for(int i = Offset; i < MAX_CLIENTS && Info.m_NumReceivedClients < MAX_CLIENTS && !Up.Error(); i++)
|
for(int i = 0; i < MAX_CLIENTS && Info.m_NumReceivedClients < MAX_CLIENTS && !Up.Error(); i++)
|
||||||
{
|
{
|
||||||
CServerInfo::CClient *pClient = &Info.m_aClients[Info.m_NumReceivedClients];
|
CServerInfo::CClient *pClient = &Info.m_aClients[Info.m_NumReceivedClients];
|
||||||
GET_STRING(pClient->m_aName);
|
GET_STRING(pClient->m_aName);
|
||||||
|
|
|
@ -720,12 +720,6 @@ void CServerBrowser::OnServerInfoUpdate(const NETADDR &Addr, int Token, const CS
|
||||||
{
|
{
|
||||||
SetInfo(pEntry, *pInfo);
|
SetInfo(pEntry, *pInfo);
|
||||||
pEntry->m_Info.m_Latency = minimum(static_cast<int>((time_get() - m_BroadcastTime) * 1000 / time_freq()), 999);
|
pEntry->m_Info.m_Latency = minimum(static_cast<int>((time_get() - m_BroadcastTime) * 1000 / time_freq()), 999);
|
||||||
if(pInfo->m_Type == SERVERINFO_VANILLA && Is64Player(pInfo))
|
|
||||||
{
|
|
||||||
pEntry->m_Request64Legacy = true;
|
|
||||||
// Force a quick update.
|
|
||||||
RequestImpl64(Addr, pEntry);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(pEntry->m_RequestTime > 0)
|
else if(pEntry->m_RequestTime > 0)
|
||||||
{
|
{
|
||||||
|
@ -747,16 +741,6 @@ void CServerBrowser::OnServerInfoUpdate(const NETADDR &Addr, int Token, const CS
|
||||||
SetLatency(Addr, Latency);
|
SetLatency(Addr, Latency);
|
||||||
}
|
}
|
||||||
pEntry->m_RequestTime = -1; // Request has been answered
|
pEntry->m_RequestTime = -1; // Request has been answered
|
||||||
|
|
||||||
if(!pEntry->m_RequestIgnoreInfo)
|
|
||||||
{
|
|
||||||
if(pInfo->m_Type == SERVERINFO_VANILLA && Is64Player(pInfo))
|
|
||||||
{
|
|
||||||
pEntry->m_Request64Legacy = true;
|
|
||||||
// Force a quick update.
|
|
||||||
RequestImpl64(Addr, pEntry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
RemoveRequest(pEntry);
|
RemoveRequest(pEntry);
|
||||||
|
|
||||||
|
@ -872,35 +856,6 @@ void CServerBrowser::RequestImpl(const NETADDR &Addr, CServerEntry *pEntry, int
|
||||||
pEntry->m_RequestTime = time_get();
|
pEntry->m_RequestTime = time_get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerBrowser::RequestImpl64(const NETADDR &Addr, CServerEntry *pEntry) const
|
|
||||||
{
|
|
||||||
unsigned char aBuffer[sizeof(SERVERBROWSE_GETINFO_64_LEGACY) + 1];
|
|
||||||
CNetChunk Packet;
|
|
||||||
|
|
||||||
if(g_Config.m_Debug)
|
|
||||||
{
|
|
||||||
char aAddrStr[NETADDR_MAXSTRSIZE];
|
|
||||||
net_addr_str(&Addr, aAddrStr, sizeof(aAddrStr), true);
|
|
||||||
char aBuf[256];
|
|
||||||
str_format(aBuf, sizeof(aBuf), "requesting server info 64 from %s", aAddrStr);
|
|
||||||
m_pConsole->Print(IConsole::OUTPUT_LEVEL_DEBUG, "client_srvbrowse", aBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
mem_copy(aBuffer, SERVERBROWSE_GETINFO_64_LEGACY, sizeof(SERVERBROWSE_GETINFO_64_LEGACY));
|
|
||||||
aBuffer[sizeof(SERVERBROWSE_GETINFO_64_LEGACY)] = GetBasicToken(GenerateToken(Addr));
|
|
||||||
|
|
||||||
Packet.m_ClientID = -1;
|
|
||||||
Packet.m_Address = Addr;
|
|
||||||
Packet.m_Flags = NETSENDFLAG_CONNLESS;
|
|
||||||
Packet.m_DataSize = sizeof(aBuffer);
|
|
||||||
Packet.m_pData = aBuffer;
|
|
||||||
|
|
||||||
m_pNetClient->Send(&Packet);
|
|
||||||
|
|
||||||
if(pEntry)
|
|
||||||
pEntry->m_RequestTime = time_get();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CServerBrowser::RequestCurrentServer(const NETADDR &Addr) const
|
void CServerBrowser::RequestCurrentServer(const NETADDR &Addr) const
|
||||||
{
|
{
|
||||||
RequestImpl(Addr, nullptr, nullptr, nullptr, false);
|
RequestImpl(Addr, nullptr, nullptr, nullptr, false);
|
||||||
|
@ -1123,10 +1078,7 @@ void CServerBrowser::Update(bool ForceResort)
|
||||||
|
|
||||||
if(pEntry->m_RequestTime == 0)
|
if(pEntry->m_RequestTime == 0)
|
||||||
{
|
{
|
||||||
if(pEntry->m_Request64Legacy)
|
RequestImpl(pEntry->m_Info.m_aAddresses[0], pEntry, nullptr, nullptr, false);
|
||||||
RequestImpl64(pEntry->m_Info.m_aAddresses[0], pEntry);
|
|
||||||
else
|
|
||||||
RequestImpl(pEntry->m_Info.m_aAddresses[0], pEntry, nullptr, nullptr, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Count++;
|
Count++;
|
||||||
|
@ -1563,8 +1515,3 @@ bool CServerInfo::ParseLocation(int *pResult, const char *pString)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Is64Player(const CServerInfo *pInfo)
|
|
||||||
{
|
|
||||||
return str_find(pInfo->m_aGameType, "64") || str_find(pInfo->m_aName, "64") || str_find_nocase(pInfo->m_aGameType, "ddracenet") || str_find_nocase(pInfo->m_aGameType, "ddnet");
|
|
||||||
}
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ public:
|
||||||
int64_t m_RequestTime;
|
int64_t m_RequestTime;
|
||||||
bool m_RequestIgnoreInfo;
|
bool m_RequestIgnoreInfo;
|
||||||
int m_GotInfo;
|
int m_GotInfo;
|
||||||
bool m_Request64Legacy;
|
|
||||||
CServerInfo m_Info;
|
CServerInfo m_Info;
|
||||||
|
|
||||||
CServerEntry *m_pPrevReq; // request list
|
CServerEntry *m_pPrevReq; // request list
|
||||||
|
@ -131,7 +130,6 @@ public:
|
||||||
void SetBaseInfo(class CNetClient *pClient, const char *pNetVersion);
|
void SetBaseInfo(class CNetClient *pClient, const char *pNetVersion);
|
||||||
void OnInit();
|
void OnInit();
|
||||||
|
|
||||||
void RequestImpl64(const NETADDR &Addr, CServerEntry *pEntry) const;
|
|
||||||
void QueueRequest(CServerEntry *pEntry);
|
void QueueRequest(CServerEntry *pEntry);
|
||||||
CServerEntry *Find(const NETADDR &Addr);
|
CServerEntry *Find(const NETADDR &Addr);
|
||||||
int GetCurrentType() override { return m_ServerlistType; }
|
int GetCurrentType() override { return m_ServerlistType; }
|
||||||
|
|
|
@ -85,8 +85,6 @@ public:
|
||||||
static bool ParseLocation(int *pResult, const char *pString);
|
static bool ParseLocation(int *pResult, const char *pString);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool Is64Player(const CServerInfo *pInfo);
|
|
||||||
|
|
||||||
class IServerBrowser : public IInterface
|
class IServerBrowser : public IInterface
|
||||||
{
|
{
|
||||||
MACRO_INTERFACE("serverbrowser", 0)
|
MACRO_INTERFACE("serverbrowser", 0)
|
||||||
|
|
Loading…
Reference in a new issue