diff options
author | sfan5 <sfan5@live.de> | 2021-09-17 18:14:25 +0200 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2021-10-19 19:22:46 +0100 |
commit | 05b54a8d18051a3452c405f58bee5852f3d3a27b (patch) | |
tree | 961f7e79c3c64d4074e228ff0c415820eded32ea /src/unittest/test_connection.cpp | |
parent | e5cfdd369ed96a7906a6ed6de7eb3878a10fc57c (diff) | |
download | minetest-05b54a8d18051a3452c405f58bee5852f3d3a27b.tar.gz minetest-05b54a8d18051a3452c405f58bee5852f3d3a27b.tar.bz2 minetest-05b54a8d18051a3452c405f58bee5852f3d3a27b.zip |
Shave off buffer copies in networking code (#11607)
Diffstat (limited to 'src/unittest/test_connection.cpp')
-rw-r--r-- | src/unittest/test_connection.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/unittest/test_connection.cpp b/src/unittest/test_connection.cpp index c3aacc536..23b7e9105 100644 --- a/src/unittest/test_connection.cpp +++ b/src/unittest/test_connection.cpp @@ -88,7 +88,7 @@ void TestConnection::testNetworkPacketSerialize() }; if (sizeof(wchar_t) == 2) - warningstream << __func__ << " may fail on this platform." << std::endl; + warningstream << __FUNCTION__ << " may fail on this platform." << std::endl; { NetworkPacket pkt(123, 0); @@ -96,7 +96,7 @@ void TestConnection::testNetworkPacketSerialize() // serializing wide strings should do surrogate encoding, we test that here pkt << std::wstring(L"\U00020b9a"); - SharedBuffer<u8> buf = pkt.oldForgePacket(); + auto buf = pkt.oldForgePacket(); UASSERTEQ(int, buf.getSize(), sizeof(expected)); UASSERT(!memcmp(expected, &buf[0], buf.getSize())); } @@ -280,7 +280,7 @@ void TestConnection::testConnectSendReceive() NetworkPacket pkt; pkt.putRawPacket((u8*) "Hello World !", 14, 0); - SharedBuffer<u8> sentdata = pkt.oldForgePacket(); + auto sentdata = pkt.oldForgePacket(); infostream<<"** running client.Send()"<<std::endl; client.Send(PEER_ID_SERVER, 0, &pkt, true); @@ -295,7 +295,7 @@ void TestConnection::testConnectSendReceive() << ", data=" << (const char*)pkt.getU8Ptr(0) << std::endl; - SharedBuffer<u8> recvdata = pkt.oldForgePacket(); + auto recvdata = pkt.oldForgePacket(); UASSERT(memcmp(*sentdata, *recvdata, recvdata.getSize()) == 0); } @@ -324,13 +324,13 @@ void TestConnection::testConnectSendReceive() infostream << "..."; infostream << std::endl; - SharedBuffer<u8> sentdata = pkt.oldForgePacket(); + auto sentdata = pkt.oldForgePacket(); server.Send(peer_id_client, 0, &pkt, true); //sleep_ms(3000); - SharedBuffer<u8> recvdata; + Buffer<u8> recvdata; infostream << "** running client.Receive()" << std::endl; session_t peer_id = 132; u16 size = 0; |