Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix BufferedPacket race condition (fixes #2983)
This was caused by the use the non-threadsafe SharedBuffer in a
threaded context.
  • Loading branch information
kwolekr committed Aug 6, 2015
1 parent bd0b469 commit 8560ece
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/network/connection.h
Expand Up @@ -172,7 +172,7 @@ struct BufferedPacket
data(a_size), time(0.0), totaltime(0.0), absolute_send_time(-1),
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 totaltime; // Seconds from buffering the packet
unsigned int absolute_send_time;
Expand Down
8 changes: 8 additions & 0 deletions src/util/pointer.h
Expand Up @@ -178,6 +178,14 @@ class Buffer
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>
class SharedBuffer
{
Expand Down

0 comments on commit 8560ece

Please sign in to comment.