diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2017-09-03 19:01:53 +0200 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2017-09-03 19:01:53 +0200 |
commit | eabf04bd34b840ee3359609fc977cf4795b33a3a (patch) | |
tree | e44966316c6e121a2987a28a7c7decc5365b890c /src/network/connection.cpp | |
parent | 2ac5a45faa26a9192ab3c3940d939b18b0df8b38 (diff) | |
download | minetest-eabf04bd34b840ee3359609fc977cf4795b33a3a.tar.gz minetest-eabf04bd34b840ee3359609fc977cf4795b33a3a.tar.bz2 minetest-eabf04bd34b840ee3359609fc977cf4795b33a3a.zip |
Network part requires SharedBuffers to be pass as value
This can trigger unreproductible crashes due to concurrency problem on SharedBuffers
This fixes #6354
Diffstat (limited to 'src/network/connection.cpp')
-rw-r--r-- | src/network/connection.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/network/connection.cpp b/src/network/connection.cpp index 01f1a7e63..b2e443901 100644 --- a/src/network/connection.cpp +++ b/src/network/connection.cpp @@ -55,7 +55,7 @@ std::mutex log_message_mutex; #define PING_TIMEOUT 5.0 -BufferedPacket makePacket(Address &address, const SharedBuffer<u8> &data, +BufferedPacket makePacket(Address &address, SharedBuffer<u8> data, u32 protocol_id, u16 sender_peer_id, u8 channel) { u32 packet_size = data.getSize() + BASE_HEADER_SIZE; @@ -125,7 +125,7 @@ void makeSplitPacket(const SharedBuffer<u8> &data, u32 chunksize_max, u16 seqnum } } -void makeAutoSplitPacket(const SharedBuffer<u8> &data, u32 chunksize_max, +void makeAutoSplitPacket(SharedBuffer<u8> data, u32 chunksize_max, u16 &split_seqnum, std::list<SharedBuffer<u8>> *list) { u32 original_header_size = 1; @@ -139,9 +139,7 @@ void makeAutoSplitPacket(const SharedBuffer<u8> &data, u32 chunksize_max, list->push_back(makeOriginalPacket(data)); } -SharedBuffer<u8> makeReliablePacket( - const SharedBuffer<u8> &data, - u16 seqnum) +SharedBuffer<u8> makeReliablePacket(SharedBuffer<u8> data, u16 seqnum) { u32 header_size = 3; u32 packet_size = data.getSize() + header_size; |