forked from mirrors/0ad
Adding Engine Version and Mod name/version checks to multiplayer handshake.
Incrementing protocol version as handshake messages have changed.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "NetSession.h"
|
||||
#include "NetServerTurnManager.h"
|
||||
#include "NetStats.h"
|
||||
#include "NetProtocol.h"
|
||||
|
||||
#include "lib/external_libraries/enet.h"
|
||||
#include "lib/types.h"
|
||||
@@ -708,11 +709,8 @@ bool CNetServerWorker::HandleConnect(CNetServerSession* session)
|
||||
return false;
|
||||
}
|
||||
|
||||
CSrvHandshakeMessage handshake;
|
||||
handshake.m_Magic = PS_PROTOCOL_MAGIC;
|
||||
handshake.m_ProtocolVersion = PS_PROTOCOL_VERSION;
|
||||
handshake.m_SoftwareVersion = PS_PROTOCOL_VERSION;
|
||||
return session->SendMessage(&handshake);
|
||||
const CSrvHandshakeMessage handshake(CreateHandshake<CSrvHandshakeMessage>());
|
||||
return session->SendMessage(&handshake);
|
||||
}
|
||||
|
||||
void CNetServerWorker::OnUserJoin(CNetServerSession* session)
|
||||
@@ -920,6 +918,12 @@ bool CNetServerWorker::OnClientHandshake(CNetServerSession* session, CFsmEvent*
|
||||
return false;
|
||||
}
|
||||
|
||||
if (CheckHandshake(CreateHandshake<CSrvHandshakeMessage>(), *message))
|
||||
{
|
||||
session->Disconnect(NDR_INCORRECT_SOFTWARE_VERSION);
|
||||
return false;
|
||||
}
|
||||
|
||||
CStr guid = ps_generate_guid();
|
||||
int count = 0;
|
||||
// Ensure unique GUID
|
||||
|
||||
Reference in New Issue
Block a user