aboutsummaryrefslogtreecommitdiff
path: root/src/network/connection.h
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2015-03-31 10:35:51 +0200
committerLoic Blot <loic.blot@unix-experience.fr>2015-03-31 11:01:08 +0200
commit1fe4256462826c218ed9bf171be4c07e0db33e25 (patch)
tree8c07a04333c23599376327e847d030cfe6bec162 /src/network/connection.h
parentab77bf98ee320835e5dc50ed9b013442221f96e8 (diff)
downloadhax-minetest-server-1fe4256462826c218ed9bf171be4c07e0db33e25.tar.gz
hax-minetest-server-1fe4256462826c218ed9bf171be4c07e0db33e25.zip
Connection::Receive(): receive Network Packet instead of SharedBuffer<u8>.
Because we get a Buffer<u8> from ConnectionEvent, don't convert it to SharedBuffer<u8> and return it to Server/Client::Receive which will convert it to NetworkPacket Instead, put the Buffer<u8> 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
Diffstat (limited to 'src/network/connection.h')
-rw-r--r--src/network/connection.h4
1 files changed, 3 insertions, 1 deletions
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 <list>
#include <map>
+class NetworkPacket;
+
namespace con
{
@@ -1025,7 +1027,7 @@ public:
void Connect(Address address);
bool Connected();
void Disconnect();
- u32 Receive(u16 &peer_id, SharedBuffer<u8> &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);