]> git.lizzy.rs Git - minetest.git/blobdiff - src/connection.cpp
New kind of tool speed and wear calculation thingy
[minetest.git] / src / connection.cpp
index cdf8cd3b49cd87bc38daec980d0285514525ed76..b9c5d2ac8bac413c1264ac6746e873fca0c471e7 100644 (file)
@@ -670,7 +670,7 @@ void Connection::receive()
        // TODO: We can not know how many layers of header there are.
        // For now, just assume there are no other than the base headers.
        u32 packet_maxsize = datasize + BASE_HEADER_SIZE;
-       Buffer<u8> packetdata(packet_maxsize);
+       SharedBuffer<u8> packetdata(packet_maxsize);
 
        bool single_wait_done = false;
        
@@ -1577,7 +1577,7 @@ void Connection::Disconnect()
        putCommand(c);
 }
 
-u32 Connection::Receive(u16 &peer_id, u8 *data, u32 datasize)
+u32 Connection::Receive(u16 &peer_id, SharedBuffer<u8> &data)
 {
        for(;;){
                ConnectionEvent e = waitEvent(m_bc_receive_timeout);
@@ -1589,7 +1589,7 @@ u32 Connection::Receive(u16 &peer_id, u8 *data, u32 datasize)
                        throw NoIncomingDataException("No incoming data");
                case CONNEVENT_DATA_RECEIVED:
                        peer_id = e.peer_id;
-                       memcpy(data, *e.data, e.data.getSize());
+                       data = SharedBuffer<u8>(e.data);
                        return e.data.getSize();
                case CONNEVENT_PEER_ADDED: {
                        Peer tmp(e.peer_id, e.address);