Don't spam server console on player/playersao error but just drop the affected client
authorsapier <Sapier at GMX dot net>
Sun, 29 Jun 2014 15:55:21 +0000 (17:55 +0200)
committersapier <Sapier at GMX dot net>
Sun, 29 Jun 2014 15:55:21 +0000 (17:55 +0200)
src/server.cpp

index 122ea993d21551bb6a04a58700552523d138a6ae..1223136b4a5ca15565670f4b8c1a396bd0ea3985 100644 (file)
@@ -1789,18 +1789,20 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
        }
 
        Player *player = m_env->getPlayer(peer_id);
-       if(player == NULL){
+       if(player == NULL) {
                errorstream<<"Server::ProcessData(): Cancelling: "
                                "No player for peer_id="<<peer_id
-                               <<std::endl;
+                               << " disconnecting peer!" <<std::endl;
+               m_con.DisconnectPeer(peer_id);
                return;
        }
 
        PlayerSAO *playersao = player->getPlayerSAO();
-       if(playersao == NULL){
+       if(playersao == NULL) {
                errorstream<<"Server::ProcessData(): Cancelling: "
                                "No player object for peer_id="<<peer_id
-                               <<std::endl;
+                               << " disconnecting peer!" <<std::endl;
+               m_con.DisconnectPeer(peer_id);
                return;
        }