summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-12-22 16:19:28 +0100
committerGitHub <noreply@github.com>2019-12-22 16:19:28 +0100
commitac046b7bac7cc6769eaf275c31ec3a497dea48cc (patch)
tree07a2e5422ab3d1eb93489ddda24db5c3c9457f79
parent8938577459ba1f33a814833c06d92e775c04bb5e (diff)
parentcbc772d696e0148f2788f3b78115c70296d6d34a (diff)
Merge pull request #34542 from Faless/net/packet_peer_stream_input_buffer
Fix buffers size calculation in PacketPeerStream.
-rw-r--r--core/io/packet_peer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index 23dfc58385..03bc4d453a 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -282,7 +282,7 @@ void PacketPeerStream::set_input_buffer_max_size(int p_max_size) {
ERR_FAIL_COND_MSG(p_max_size < 0, "Max size of input buffer size cannot be smaller than 0.");
//warning may lose packets
ERR_FAIL_COND_MSG(ring_buffer.data_left(), "Buffer in use, resizing would cause loss of data.");
- ring_buffer.resize(nearest_shift(p_max_size + 4));
+ ring_buffer.resize(nearest_shift(next_power_of_2(p_max_size + 4)) - 1);
input_buffer.resize(next_power_of_2(p_max_size + 4));
}