Fix JoinVer and Join teehistorian chunks missing in some conditions

vanilla 0.6 joins weren't recorded. Also after map change, for the
existing players these Join chunks were missing.  Just add these
message for existing players now and add OnClientEngineJoin in all
code paths with clients connecting.
This commit is contained in:
Zwelf 2023-06-15 16:09:31 +02:00
parent 107ac6705d
commit b9458150e0
3 changed files with 18 additions and 2 deletions

View file

@ -1062,6 +1062,9 @@ int CServer::ClientRejoinCallback(int ClientID, void *pUser)
pThis->m_aClients[ClientID].Reset(); pThis->m_aClients[ClientID].Reset();
pThis->GameServer()->OnClientEngineJoin(ClientID, pThis->m_aClients[ClientID].m_Sixup);
pThis->Antibot()->OnEngineClientJoin(ClientID, pThis->m_aClients[ClientID].m_Sixup);
pThis->SendMap(ClientID); pThis->SendMap(ClientID);
return 0; return 0;
@ -1087,6 +1090,9 @@ int CServer::NewClientNoAuthCallback(int ClientID, void *pUser)
pThis->m_aClients[ClientID].m_DDNetVersionSettled = false; pThis->m_aClients[ClientID].m_DDNetVersionSettled = false;
pThis->m_aClients[ClientID].Reset(); pThis->m_aClients[ClientID].Reset();
pThis->GameServer()->OnClientEngineJoin(ClientID, false);
pThis->Antibot()->OnEngineClientJoin(ClientID, false);
pThis->SendCapabilities(ClientID); pThis->SendCapabilities(ClientID);
pThis->SendMap(ClientID); pThis->SendMap(ClientID);
#if defined(CONF_FAMILY_UNIX) #if defined(CONF_FAMILY_UNIX)
@ -2781,6 +2787,16 @@ int CServer::Run()
break; break;
} }
UpdateServerInfo(true); UpdateServerInfo(true);
for(int ClientID = 0; ClientID < MAX_CLIENTS; ClientID++)
{
if(m_aClients[ClientID].m_State != CClient::STATE_CONNECTING)
continue;
// When doing a map change, a new Teehistorian file is created. For players that are already
// on the server, no PlayerJoin event is produced in Teehistorian from the network engine.
// Record PlayerJoin events here to record the Sixup version and player join event.
GameServer()->OnClientEngineJoin(ClientID, m_aClients[ClientID].m_Sixup);
}
} }
else else
{ {

View file

@ -8,7 +8,7 @@
static const char TEEHISTORIAN_NAME[] = "teehistorian@ddnet.tw"; static const char TEEHISTORIAN_NAME[] = "teehistorian@ddnet.tw";
static const CUuid TEEHISTORIAN_UUID = CalculateUuid(TEEHISTORIAN_NAME); static const CUuid TEEHISTORIAN_UUID = CalculateUuid(TEEHISTORIAN_NAME);
static const char TEEHISTORIAN_VERSION[] = "2"; static const char TEEHISTORIAN_VERSION[] = "2";
static const char TEEHISTORIAN_VERSION_MINOR[] = "4"; static const char TEEHISTORIAN_VERSION_MINOR[] = "5";
#define UUID(id, name) static const CUuid UUID_##id = CalculateUuid(name); #define UUID(id, name) static const CUuid UUID_##id = CalculateUuid(name);
#include <engine/shared/teehistorian_ex_chunks.h> #include <engine/shared/teehistorian_ex_chunks.h>

View file

@ -101,7 +101,7 @@ protected:
void Expect(const unsigned char *pOutput, size_t OutputSize) void Expect(const unsigned char *pOutput, size_t OutputSize)
{ {
static CUuid TEEHISTORIAN_UUID = CalculateUuid("teehistorian@ddnet.tw"); static CUuid TEEHISTORIAN_UUID = CalculateUuid("teehistorian@ddnet.tw");
static const char PREFIX1[] = "{\"comment\":\"teehistorian@ddnet.tw\",\"version\":\"2\",\"version_minor\":\"4\",\"game_uuid\":\"a1eb7182-796e-3b3e-941d-38ca71b2a4a8\",\"server_version\":\"DDNet test\",\"start_time\":\""; static const char PREFIX1[] = "{\"comment\":\"teehistorian@ddnet.tw\",\"version\":\"2\",\"version_minor\":\"5\",\"game_uuid\":\"a1eb7182-796e-3b3e-941d-38ca71b2a4a8\",\"server_version\":\"DDNet test\",\"start_time\":\"";
static const char PREFIX2[] = "\",\"server_name\":\"server name\",\"server_port\":\"8303\",\"game_type\":\"game type\",\"map_name\":\"Kobra 3 Solo\",\"map_size\":\"903514\",\"map_sha256\":\"0123456789012345678901234567890123456789012345678901234567890123\",\"map_crc\":\"eceaf25c\",\"prng_description\":\"test-prng:02468ace\",\"config\":{},\"tuning\":{},\"uuids\":["; static const char PREFIX2[] = "\",\"server_name\":\"server name\",\"server_port\":\"8303\",\"game_type\":\"game type\",\"map_name\":\"Kobra 3 Solo\",\"map_size\":\"903514\",\"map_sha256\":\"0123456789012345678901234567890123456789012345678901234567890123\",\"map_crc\":\"eceaf25c\",\"prng_description\":\"test-prng:02468ace\",\"config\":{},\"tuning\":{},\"uuids\":[";
static const char PREFIX3[] = "]}"; static const char PREFIX3[] = "]}";