MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / ProcessConnectMessage

Method ProcessConnectMessage

neo/framework/async/AsyncServer.cpp:1664–1866  ·  view source on GitHub ↗

================== idAsyncServer::ProcessConnectMessage ================== */

Source from the content-addressed store, hash-verified

1662==================
1663*/
1664void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg &msg ) {
1665 int clientNum, protocol, clientDataChecksum, challenge, clientId, ping, clientRate;
1666 idBitMsg outMsg;
1667 byte msgBuf[ MAX_MESSAGE_SIZE ];
1668 char guid[ 12 ];
1669 char password[ 17 ];
1670 int i, ichallenge, islot, numClients;
1671
1672 protocol = msg.ReadInt();
1673
1674 // check the protocol version
1675 if ( protocol != ASYNC_PROTOCOL_VERSION ) {
1676 // that's a msg back to a client, we don't know about it's localization, so send english
1677 PrintOOB( from, SERVER_PRINT_BADPROTOCOL, va( "server uses protocol %d.%d\n", ASYNC_PROTOCOL_MAJOR, ASYNC_PROTOCOL_MINOR ) );
1678 return;
1679 }
1680
1681 clientDataChecksum = msg.ReadInt();
1682 challenge = msg.ReadInt();
1683 clientId = msg.ReadShort();
1684 clientRate = msg.ReadInt();
1685
1686 // check the client data - only for non pure servers
1687 if ( !sessLocal.mapSpawnData.serverInfo.GetInt( "si_pure" ) && clientDataChecksum != serverDataChecksum ) {
1688 PrintOOB( from, SERVER_PRINT_MISC, "#str_04842" );
1689 return;
1690 }
1691
1692 if ( ( ichallenge = ValidateChallenge( from, challenge, clientId ) ) == -1 ) {
1693 return;
1694 }
1695
1696 msg.ReadString( guid, sizeof( guid ) );
1697
1698 switch ( challenges[ ichallenge ].authState ) {
1699 case CDK_PUREWAIT:
1700 SendPureServerMessage( from );
1701 return;
1702 case CDK_ONLYLAN:
1703 common->DPrintf( "%s: not a lan client\n", Sys_NetAdrToString( from ) );
1704 PrintOOB( from, SERVER_PRINT_MISC, "#str_04843" );
1705 return;
1706 case CDK_WAIT:
1707 if ( challenges[ ichallenge ].authReply == AUTH_NONE && Min( serverTime - lastAuthTime, serverTime - challenges[ ichallenge ].time ) > AUTHORIZE_TIMEOUT ) {
1708 common->DPrintf( "%s: Authorize server timed out\n", Sys_NetAdrToString( from ) );
1709 break; // will continue with the connecting process
1710 }
1711 const char *msg, *l_msg;
1712 if ( challenges[ ichallenge ].authReplyMsg != AUTH_REPLY_PRINT ) {
1713 msg = authReplyMsg[ challenges[ ichallenge ].authReplyMsg ];
1714 } else {
1715 msg = challenges[ ichallenge ].authReplyPrint.c_str();
1716 }
1717 l_msg = common->GetLanguageDict()->GetString( msg );
1718
1719 common->DPrintf( "%s: %s\n", Sys_NetAdrToString( from ), l_msg );
1720
1721 if ( challenges[ ichallenge ].authReplyMsg == AUTH_REPLY_UNKNOWN || challenges[ ichallenge ].authReplyMsg == AUTH_REPLY_WAITING ) {

Callers

nothing calls this directly

Calls 15

vaFunction · 0.85
MinFunction · 0.85
WriteNetadrMethod · 0.80
RunningD3XPMethod · 0.80
GetRemoteAddressMethod · 0.80
WriteDeltaDictMethod · 0.80
Sys_NetAdrToStringFunction · 0.50
Sys_CompareNetAdrBaseFunction · 0.50
ReadIntMethod · 0.45
ReadShortMethod · 0.45
GetIntMethod · 0.45
ReadStringMethod · 0.45

Tested by

no test coverage detected