1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +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

@ -1777,14 +1777,13 @@ void Server::AsyncRunStep()
void Server::Receive()
{
DSTACK(__FUNCTION_NAME);
u32 data_maxsize = 10000;
Buffer<u8> data(data_maxsize);
SharedBuffer<u8> data;
u16 peer_id;
u32 datasize;
try{
{
JMutexAutoLock conlock(m_con_mutex);
datasize = m_con.Receive(peer_id, *data, data_maxsize);
datasize = m_con.Receive(peer_id, data);
}
// This has to be called so that the client list gets synced