mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Send initial dummy packet as empty
No functional change and no compatibility implicatons but this better matches what is documented everywhere.
This commit is contained in:
parent
eeb873b23c
commit
abf3142b26
@ -552,6 +552,12 @@ NetworkPacket& NetworkPacket::operator<<(video::SColor src)
|
||||
|
||||
Buffer<u8> NetworkPacket::oldForgePacket()
|
||||
{
|
||||
// this is the dummy packet used to first contact the server
|
||||
if (m_command == 0) {
|
||||
assert(m_datasize == 0);
|
||||
return Buffer<u8>();
|
||||
}
|
||||
|
||||
Buffer<u8> sb(m_datasize + 2);
|
||||
writeU16(&sb[0], m_command);
|
||||
if (m_datasize > 0)
|
||||
|
@ -277,8 +277,8 @@ void TestConnection::testConnectSendReceive()
|
||||
Simple send-receive test
|
||||
*/
|
||||
{
|
||||
NetworkPacket pkt;
|
||||
pkt.putRawPacket((u8*) "Hello World !", 14, 0);
|
||||
NetworkPacket pkt(0x4b, 0);
|
||||
pkt.putRawString("Hello World !", 14);
|
||||
|
||||
auto sentdata = pkt.oldForgePacket();
|
||||
|
||||
@ -306,9 +306,9 @@ void TestConnection::testConnectSendReceive()
|
||||
*/
|
||||
{
|
||||
const int datasize = 30000;
|
||||
NetworkPacket pkt(0, datasize);
|
||||
NetworkPacket pkt(0xff, datasize);
|
||||
for (u16 i=0; i<datasize; i++) {
|
||||
pkt << (u8) i/4;
|
||||
pkt << static_cast<u8>(i/4);
|
||||
}
|
||||
|
||||
infostream << "Sending data (size=" << datasize << "):";
|
||||
|
Loading…
Reference in New Issue
Block a user