diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-08-24 08:28:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-24 08:28:54 +0200 |
commit | c7160cb629086df2a32c7dcf4faed4761ec4393e (patch) | |
tree | 63670a536ce95f6a3a1ce09bf2f2f65d1bec5214 /src/network/serverpackethandler.cpp | |
parent | 928609c8bd9d4e6129ab244214bd5c54d000b737 (diff) | |
download | minetest-c7160cb629086df2a32c7dcf4faed4761ec4393e.tar.xz |
Network cleanup (#6302)
* Cleanup network headers
* Move peerhandler to a specific header to reduce compilation times
* Move socket.cpp/h to network folder
* More work
* Network code cleanups
* Move socket.{cpp,h} to network folder
* Move Address object to network/address.{cpp,h}
* Move network exceptions to network/networkexceptions.h
* Client: use unique_ptr for Connection
* Server/ClientIface: use shared_ptr for Connection
* Format fixes
* Remove socket.cpp socket.h from clang-format whitelist
* Also fix NetworkPacket code style & make it under clang-format
Diffstat (limited to 'src/network/serverpackethandler.cpp')
-rw-r--r-- | src/network/serverpackethandler.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index ecc166d1e..09e04674c 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "settings.h" #include "tool.h" #include "version.h" +#include "network/connection.h" #include "network/networkprotocol.h" #include "network/serveropcodes.h" #include "util/auth.h" @@ -686,7 +687,7 @@ void Server::handleCommand_ClientReady(NetworkPacket* pkt) actionstream << "TOSERVER_CLIENT_READY stage 2 client init failed for peer_id: " << peer_id << std::endl; - m_con.DisconnectPeer(peer_id); + m_con->DisconnectPeer(peer_id); return; } @@ -695,7 +696,7 @@ void Server::handleCommand_ClientReady(NetworkPacket* pkt) errorstream << "TOSERVER_CLIENT_READY client sent inconsistent data, disconnecting peer_id: " << peer_id << std::endl; - m_con.DisconnectPeer(peer_id); + m_con->DisconnectPeer(peer_id); return; } @@ -830,7 +831,7 @@ void Server::handleCommand_PlayerPos(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -839,7 +840,7 @@ void Server::handleCommand_PlayerPos(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player object for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -891,7 +892,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -900,7 +901,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player object for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -1072,7 +1073,7 @@ void Server::handleCommand_ChatMessage(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -1100,7 +1101,7 @@ void Server::handleCommand_Damage(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -1109,7 +1110,7 @@ void Server::handleCommand_Damage(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player object for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -1166,7 +1167,7 @@ void Server::handleCommand_Password(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -1219,7 +1220,7 @@ void Server::handleCommand_PlayerItem(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -1228,7 +1229,7 @@ void Server::handleCommand_PlayerItem(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player object for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -1246,7 +1247,7 @@ void Server::handleCommand_Respawn(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -1299,7 +1300,7 @@ void Server::handleCommand_Interact(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -1308,7 +1309,7 @@ void Server::handleCommand_Interact(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player object for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -1738,7 +1739,7 @@ void Server::handleCommand_NodeMetaFields(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -1747,7 +1748,7 @@ void Server::handleCommand_NodeMetaFields(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player object for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -1789,7 +1790,7 @@ void Server::handleCommand_InventoryFields(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } @@ -1798,7 +1799,7 @@ void Server::handleCommand_InventoryFields(NetworkPacket* pkt) errorstream << "Server::ProcessData(): Canceling: " "No player object for peer_id=" << pkt->getPeerId() << " disconnecting peer!" << std::endl; - m_con.DisconnectPeer(pkt->getPeerId()); + m_con->DisconnectPeer(pkt->getPeerId()); return; } |