Skip to content
Permalink
Browse files

Use a Buffer instead of SharedBuffer in ConnectionCommand

This fixes #6373
  • Loading branch information...
nerzhul committed Sep 5, 2017
1 parent f231112 commit a3c298e1d1f02634e87c7ba1746fd7e9ed444875
Showing with 13 additions and 1 deletion.
  1. +1 −1 src/network/connection.h
  2. +12 −0 src/util/pointer.h
@@ -325,7 +325,7 @@ struct ConnectionCommand
Address address;
u16 peer_id = PEER_ID_INEXISTENT;
u8 channelnum = 0;
SharedBuffer<u8> data;
Buffer<u8> data;
bool reliable = false;
bool raw = false;

@@ -168,6 +168,18 @@ class SharedBuffer
/*
Copies whole buffer
*/
SharedBuffer(const Buffer<T> &buffer)
{
m_size = buffer.getSize();
if (m_size != 0) {
data = new T[m_size];
memcpy(data, *buffer, buffer.getSize());
}
else
data = NULL;
refcount = new unsigned int;
(*refcount) = 1;
}
~SharedBuffer()
{
drop();

0 comments on commit a3c298e

Please sign in to comment.
You can’t perform that action at this time.