Просмотр исходного кода

Make the global packet_buffer owned by common (#8073)

Vincent Stumpf 1 год назад
Родитель
Сommit
1c31d9c83e
2 измененных файлов с 5 добавлено и 1 удалено
  1. 4 0
      src/common/socket.cpp
  2. 1 1
      src/common/socket.hpp

+ 4 - 0
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)
 /////////////////////////////////////////////////////////////////////

+ 1 - 1
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 <typename P>
 bool socket_send( int fd, P& packet ){