From: Loic Blot Date: Sun, 22 Mar 2015 11:18:16 +0000 (+0100) Subject: Remove unused ConnectionCommand::sendToAll function. NetworkPacket::oldForgePacket... X-Git-Tag: 0.4.13~450 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=61f2d0ca3417b2a18a60015bf5423629d81bb754;p=oweals%2Fminetest.git Remove unused ConnectionCommand::sendToAll function. NetworkPacket::oldForgePacket returns Buffer instead of SharedBuffer and is used in ConnectionCommand instead of Connection::Send This remove the NetworkPacket buffer => SharedBuffer => Buffer copy. Now NetworkPacket => Buffer --- diff --git a/src/network/connection.cpp b/src/network/connection.cpp index 69deb4dd5..d51324ed4 100644 --- a/src/network/connection.cpp +++ b/src/network/connection.cpp @@ -2924,7 +2924,7 @@ void Connection::Send(u16 peer_id, u8 channelnum, ConnectionCommand c; - c.send(peer_id, channelnum, pkt->oldForgePacket(), reliable); + c.send(peer_id, channelnum, pkt, reliable); putCommand(c); } diff --git a/src/network/connection.h b/src/network/connection.h index 33b7d0f7f..0aa63d4cf 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -437,19 +437,12 @@ struct ConnectionCommand peer_id = peer_id_; } void send(u16 peer_id_, u8 channelnum_, - SharedBuffer data_, bool reliable_) + NetworkPacket* pkt, bool reliable_) { type = CONNCMD_SEND; peer_id = peer_id_; channelnum = channelnum_; - data = data_; - reliable = reliable_; - } - void sendToAll(u8 channelnum_, SharedBuffer data_, bool reliable_) - { - type = CONNCMD_SEND_TO_ALL; - channelnum = channelnum_; - data = data_; + data = pkt->oldForgePacket(); reliable = reliable_; } diff --git a/src/network/networkpacket.cpp b/src/network/networkpacket.cpp index b2b1974d7..cfbca32d3 100644 --- a/src/network/networkpacket.cpp +++ b/src/network/networkpacket.cpp @@ -510,7 +510,7 @@ NetworkPacket& NetworkPacket::operator<<(video::SColor src) return *this; } -SharedBuffer NetworkPacket::oldForgePacket() +Buffer NetworkPacket::oldForgePacket() { SharedBuffer sb(m_datasize + 2); writeU16(&sb[0], m_command); diff --git a/src/network/networkpacket.h b/src/network/networkpacket.h index e8c8565b0..4a801b444 100644 --- a/src/network/networkpacket.h +++ b/src/network/networkpacket.h @@ -104,7 +104,7 @@ public: NetworkPacket& operator<<(video::SColor src); // Temp, we remove SharedBuffer when migration finished - SharedBuffer oldForgePacket(); + Buffer oldForgePacket(); private: template void checkDataSize() {