Server::ProcessData(): call getBanName once instead of twice (#639)
authorIlya <TTChangeTheWorld@gmail.com>
Wed, 10 Apr 2013 03:34:58 +0000 (07:34 +0400)
committerKahrl <kahrl@gmx.net>
Tue, 3 Sep 2013 05:34:43 +0000 (07:34 +0200)
src/server.cpp

index 561e03c7a9dd42fa29b498a364db2fe6601cea2c..8ce8df349b43a0cb19d8ef2e8d6682a3eda67cc4 100644 (file)
@@ -1776,12 +1776,13 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
 
                // drop player if is ip is banned
                if(m_banmanager->isIpBanned(addr_s)){
+                       std::string ban_name = m_banmanager->getBanName(addr_s);
                        infostream<<"Server: A banned client tried to connect from "
                                        <<addr_s<<"; banned name was "
-                                       <<m_banmanager->getBanName(addr_s)<<std::endl;
+                                       <<ban_name<<std::endl;
                        // This actually doesn't seem to transfer to the client
                        DenyAccess(peer_id, L"Your ip is banned. Banned name was "
-                                       +narrow_to_wide(m_banmanager->getBanName(addr_s)));
+                                       +narrow_to_wide(ban_name));
                        m_con.DeletePeer(peer_id);
                        return;
                }