From c8d0b1014d1b8a1dcec542c45b0246200a57582a Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Mon, 10 Aug 2020 16:54:15 +0800 Subject: [PATCH] add a warning message --- lualib-src/lua-socket.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lualib-src/lua-socket.c b/lualib-src/lua-socket.c index 3d527473..fec74260 100644 --- a/lualib-src/lua-socket.c +++ b/lualib-src/lua-socket.c @@ -14,11 +14,13 @@ #include #include +#include "skynet.h" #include "skynet_socket.h" #define BACKLOG 32 // 2 ** 12 == 4096 #define LARGE_PAGE_NODE 12 +#define POOL_SIZE_WARNING 32 #define BUFFER_LIMIT (256 * 1024) struct buffer_node { @@ -124,6 +126,9 @@ lpushbuffer(lua_State *L) { lnewpool(L, size); free_node = lua_touserdata(L,-1); lua_rawseti(L, pool_index, tsz+1); + if (tsz > POOL_SIZE_WARNING) { + skynet_error(NULL, "Too many socket pool (%d)", tsz); + } } lua_pushlightuserdata(L, free_node->next); lua_rawseti(L, pool_index, 1); // sb poolt msg size