From be67f63f4e11e53690bf1431a236f86b484c9bf0 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Tue, 6 Oct 2015 11:33:50 +0800 Subject: Changed buffer-per-socket to buffer-per-operation. This is a difficult tradeoff to measure. I think large datagrams won't be used very frequently. So it is better to not lock a large buffer to each socket object and instead allocate and deallocate for each operation receiving a datagram larger than UDP_DATAGRAMSIZE. --- src/select.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/select.c') diff --git a/src/select.c b/src/select.c index d14c40a..9d133b7 100644 --- a/src/select.c +++ b/src/select.c @@ -39,7 +39,10 @@ static luaL_Reg func[] = { \*-------------------------------------------------------------------------*/ int select_open(lua_State *L) { lua_pushstring(L, "_SETSIZE"); - lua_pushnumber(L, FD_SETSIZE); + lua_pushinteger(L, FD_SETSIZE); + lua_rawset(L, -3); + lua_pushstring(L, "_SOCKETINVALID"); + lua_pushinteger(L, SOCKET_INVALID); lua_rawset(L, -3); luaL_setfuncs(L, func, 0); return 0; -- cgit v1.2.3-55-g6feb From fae993c118cd1b88b35d5760b233b790ac9e1109 Mon Sep 17 00:00:00 2001 From: "E. Westbrook" Date: Mon, 25 Feb 2019 15:59:29 -0700 Subject: select.c: use LUASOCKET_PRIVATE --- src/select.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/select.c') diff --git a/src/select.c b/src/select.c index 9d133b7..b615b19 100644 --- a/src/select.c +++ b/src/select.c @@ -2,7 +2,7 @@ * Select implementation * LuaSocket toolkit \*=========================================================================*/ -#include +#include "luasocket.h" #include "lua.h" #include "lauxlib.h" @@ -12,6 +12,8 @@ #include "timeout.h" #include "select.h" +#include + /*=========================================================================*\ * Internal function prototypes. \*=========================================================================*/ @@ -37,7 +39,7 @@ static luaL_Reg func[] = { /*-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/ -int select_open(lua_State *L) { +LUASOCKET_PRIVATE int select_open(lua_State *L) { lua_pushstring(L, "_SETSIZE"); lua_pushinteger(L, FD_SETSIZE); lua_rawset(L, -3); -- cgit v1.2.3-55-g6feb From c2245f35c500b44bde6295f3f47cffd1c7b7e260 Mon Sep 17 00:00:00 2001 From: "E. Westbrook" Date: Wed, 27 Feb 2019 20:59:01 -0700 Subject: select: pragma visibility --- src/select.c | 10 +--------- src/select.h | 4 ++++ 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src/select.c') diff --git a/src/select.c b/src/select.c index b615b19..bb47c45 100644 --- a/src/select.c +++ b/src/select.c @@ -4,10 +4,6 @@ \*=========================================================================*/ #include "luasocket.h" -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - #include "socket.h" #include "timeout.h" #include "select.h" @@ -33,13 +29,10 @@ static luaL_Reg func[] = { {NULL, NULL} }; -/*=========================================================================*\ -* Exported functions -\*=========================================================================*/ /*-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/ -LUASOCKET_PRIVATE int select_open(lua_State *L) { +int select_open(lua_State *L) { lua_pushstring(L, "_SETSIZE"); lua_pushinteger(L, FD_SETSIZE); lua_rawset(L, -3); @@ -219,4 +212,3 @@ static void make_assoc(lua_State *L, int tab) { i = i+1; } } - diff --git a/src/select.h b/src/select.h index 8750200..95272db 100644 --- a/src/select.h +++ b/src/select.h @@ -10,6 +10,10 @@ * true if there is data ready for reading (required for buffered input). \*=========================================================================*/ +#pragma GCC visibility push(hidden) + int select_open(lua_State *L); +#pragma GCC visibility pop + #endif /* SELECT_H */ -- cgit v1.2.3-55-g6feb