From 1fe4256462826c218ed9bf171be4c07e0db33e25 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Tue, 31 Mar 2015 10:35:51 +0200 Subject: Connection::Receive(): receive Network Packet instead of SharedBuffer. Because we get a Buffer from ConnectionEvent, don't convert it to SharedBuffer and return it to Server/Client::Receive which will convert it to NetworkPacket Instead, put the Buffer directly to NetworkPacket and return it to packet processing This remove a long existing memory copy Also check the packet size directly into Connection::Receive instead of packet processing --- src/network/connection.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/network/connection.h') diff --git a/src/network/connection.h b/src/network/connection.h index 9c920cc01..f60c66257 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -34,6 +34,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include +class NetworkPacket; + namespace con { @@ -1025,7 +1027,7 @@ public: void Connect(Address address); bool Connected(); void Disconnect(); - u32 Receive(u16 &peer_id, SharedBuffer &data); + void Receive(NetworkPacket* pkt); void Send(u16 peer_id, u8 channelnum, NetworkPacket* pkt, bool reliable); u16 GetPeerID() { return m_peer_id; } Address GetPeerAddress(u16 peer_id); -- cgit v1.2.3