mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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
This commit is contained in:
parent
ab77bf98ee
commit
1fe4256462
9 changed files with 104 additions and 98 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue