@ -131,12 +131,18 @@ NetworkRecvStatus NetworkGameSocketHandler::HandlePacket(Packet *p)
{
PacketGameType type = ( PacketGameType ) p - > Recv_uint8 ( ) ;
if ( this - > HasClientQuit ( ) ) {
DEBUG ( net , 0 , " [tcp/game] Received invalid packet from client %d " , this - > client_id ) ;
this - > CloseConnection ( ) ;
return NETWORK_RECV_STATUS_MALFORMED_PACKET ;
}
this - > last_packet = std : : chrono : : steady_clock : : now ( ) ;
this - > last_pkt_type = type ;
DEBUG ( net , 5 , " [tcp/game] received packet type %d (%s) from client %d, %s " , type , GetPacketGameTypeName ( type ) , this - > client_id , this - > GetDebugInfo ( ) . c_str ( ) ) ;
switch ( this - > HasClientQuit ( ) ? PACKET_END : type ) {
switch ( type ) {
case PACKET_SERVER_FULL : return this - > Receive_SERVER_FULL ( p ) ;
case PACKET_SERVER_BANNED : return this - > Receive_SERVER_BANNED ( p ) ;
case PACKET_CLIENT_JOIN : return this - > Receive_CLIENT_JOIN ( p ) ;
@ -190,13 +196,8 @@ NetworkRecvStatus NetworkGameSocketHandler::HandlePacket(Packet *p)
case PACKET_SERVER_CONFIG_UPDATE : return this - > Receive_SERVER_CONFIG_UPDATE ( p ) ;
default :
DEBUG ( net , 0 , " [tcp/game] Received invalid packet type %d from client %d " , type , this - > client_id ) ;
this - > CloseConnection ( ) ;
if ( this - > HasClientQuit ( ) ) {
DEBUG ( net , 0 , " [tcp/game] Received invalid packet type %d from client %d " , type , this - > client_id ) ;
} else {
DEBUG ( net , 0 , " [tcp/game] Received illegal packet from client %d " , this - > client_id ) ;
}
return NETWORK_RECV_STATUS_MALFORMED_PACKET ;
}
}