forked from Mirrorlandia_minetest/minetest
Fix BufferedPacket race condition (fixes #2983)
This was caused by the use the non-threadsafe SharedBuffer in a threaded context.
This commit is contained in:
parent
bd0b469d3d
commit
8560ece02e
@ -172,7 +172,7 @@ struct BufferedPacket
|
|||||||
data(a_size), time(0.0), totaltime(0.0), absolute_send_time(-1),
|
data(a_size), time(0.0), totaltime(0.0), absolute_send_time(-1),
|
||||||
resend_count(0)
|
resend_count(0)
|
||||||
{}
|
{}
|
||||||
SharedBuffer<u8> data; // Data of the packet, including headers
|
Buffer<u8> data; // Data of the packet, including headers
|
||||||
float time; // Seconds from buffering the packet or re-sending
|
float time; // Seconds from buffering the packet or re-sending
|
||||||
float totaltime; // Seconds from buffering the packet
|
float totaltime; // Seconds from buffering the packet
|
||||||
unsigned int absolute_send_time;
|
unsigned int absolute_send_time;
|
||||||
|
@ -178,6 +178,14 @@ private:
|
|||||||
unsigned int m_size;
|
unsigned int m_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/************************************************
|
||||||
|
* !!! W A R N I N G !!! *
|
||||||
|
* !!! A C H T U N G !!! *
|
||||||
|
* *
|
||||||
|
* This smart pointer class is NOT thread safe. *
|
||||||
|
* ONLY use in a single-threaded context! *
|
||||||
|
* *
|
||||||
|
************************************************/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class SharedBuffer
|
class SharedBuffer
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user