summaryrefslogtreecommitdiff
path: root/src/unittest/test_connection.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-09-17 18:14:25 +0200
committerGitHub <noreply@github.com>2021-09-17 18:14:25 +0200
commitfd8a8501bc26dfca2a93d51000867b8592210040 (patch)
tree2555456796bc15f7ef0f2bc24c08b9848b874b4e /src/unittest/test_connection.cpp
parentea250ff5c57301b6ea3e529c811484c743c1fde1 (diff)
downloadminetest-fd8a8501bc26dfca2a93d51000867b8592210040.tar.gz
minetest-fd8a8501bc26dfca2a93d51000867b8592210040.tar.bz2
minetest-fd8a8501bc26dfca2a93d51000867b8592210040.zip
Shave off buffer copies in networking code (#11607)
Diffstat (limited to 'src/unittest/test_connection.cpp')
-rw-r--r--src/unittest/test_connection.cpp12
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;