Skip to content

Commit

Permalink
made the version server work again. closes #1407
Browse files Browse the repository at this point in the history
oy committed Nov 20, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 8011e3e commit 3010a3a
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/versionsrv/versionsrv.cpp
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ void BuildPackets()
}
}

void SendVer(NETADDR *pAddr)
void SendVer(NETADDR *pAddr, TOKEN ResponseToken)
{
CNetChunk p;
unsigned char aData[sizeof(VERSIONSRV_VERSION) + sizeof(GAME_RELEASE_VERSION)];
@@ -71,7 +71,7 @@ void SendVer(NETADDR *pAddr)
p.m_pData = aData;
p.m_DataSize = sizeof(aData);

g_NetOp.Send(&p);
g_NetOp.Send(&p, ResponseToken);
}

int main(int argc, char **argv) // ignore_convention
@@ -100,15 +100,17 @@ int main(int argc, char **argv) // ignore_convention

// process packets
CNetChunk Packet;
while(g_NetOp.Recv(&Packet))
TOKEN ResponseToken;
while(g_NetOp.Recv(&Packet, &ResponseToken))
{
if(Packet.m_DataSize == sizeof(VERSIONSRV_GETVERSION) &&
mem_comp(Packet.m_pData, VERSIONSRV_GETVERSION, sizeof(VERSIONSRV_GETVERSION)) == 0)
{
SendVer(&Packet.m_Address);
SendVer(&Packet.m_Address, ResponseToken);
}

if(Packet.m_DataSize == sizeof(VERSIONSRV_GETMAPLIST) &&
//disable that for now
/*if(Packet.m_DataSize == sizeof(VERSIONSRV_GETMAPLIST) &&
mem_comp(Packet.m_pData, VERSIONSRV_GETMAPLIST, sizeof(VERSIONSRV_GETMAPLIST)) == 0)
{
CNetChunk p;
@@ -120,9 +122,9 @@ int main(int argc, char **argv) // ignore_convention
{
p.m_DataSize = m_aPackets[i].m_Size;
p.m_pData = &m_aPackets[i].m_Data;
g_NetOp.Send(&p);
g_NetOp.Send(&p, ResponseToken);
}
}
}*/
}

// be nice to the CPU
2 changes: 1 addition & 1 deletion src/versionsrv/versionsrv.h
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef VERSIONSRV_VERSIONSRV_H
#define VERSIONSRV_VERSIONSRV_H
static const int VERSIONSRV_PORT = 8302;
static const int VERSIONSRV_PORT = 8285;

struct CMapVersion
{

0 comments on commit 3010a3a

Please sign in to comment.