From 1c31d9c83eaec7a9f70e2d1af1378f8749b18e74 Mon Sep 17 00:00:00 2001 From: Vincent Stumpf Date: Mon, 1 Jan 2024 10:05:21 -0800 Subject: [PATCH] Make the global packet_buffer owned by common (#8073) --- src/common/socket.cpp | 4 ++++ src/common/socket.hpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/socket.cpp b/src/common/socket.cpp index c273840ee1..ef8d167502 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -47,6 +47,10 @@ #include "strlib.hpp" #include "timer.hpp" +// Reuseable global packet buffer to prevent too many allocations +// Take socket.cpp::socket_max_client_packet into consideration +int8 packet_buffer[UINT16_MAX]; + ///////////////////////////////////////////////////////////////////// #if defined(WIN32) ///////////////////////////////////////////////////////////////////// diff --git a/src/common/socket.hpp b/src/common/socket.hpp index c072ee399c..13664a1ea5 100644 --- a/src/common/socket.hpp +++ b/src/common/socket.hpp @@ -201,7 +201,7 @@ void send_shortlist_do_sends(); // Reuseable global packet buffer to prevent too many allocations // Take socket.cpp::socket_max_client_packet into consideration -static int8 packet_buffer[UINT16_MAX]; +extern int8 packet_buffer[UINT16_MAX]; template bool socket_send( int fd, P& packet ){