1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Make Connection::Receive return the data via a SharedBuffer reference, so the caller doesn't have to choose the right buffer size in advance.

Conflicts:

	src/test.cpp
This commit is contained in:
Kahrl 2011-11-07 04:20:33 +01:00 committed by Perttu Ahola
parent 28660b4c1a
commit 1c98ec94da
5 changed files with 33 additions and 35 deletions

View file

@ -665,14 +665,13 @@ void Client::ReceiveAll()
void Client::Receive()
{
DSTACK(__FUNCTION_NAME);
u32 data_maxsize = 200000;
Buffer<u8> data(data_maxsize);
SharedBuffer<u8> data;
u16 sender_peer_id;
u32 datasize;
{
//TimeTaker t1("con mutex and receive", m_device);
//JMutexAutoLock lock(m_con_mutex); //bulk comment-out
datasize = m_con.Receive(sender_peer_id, *data, data_maxsize);
datasize = m_con.Receive(sender_peer_id, data);
}
//TimeTaker t1("ProcessData", m_device);
ProcessData(*data, datasize, sender_peer_id);