mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 12:28:21 +01:00
Merge branch 'KateAdams-tcp_reuseport'
This commit is contained in:
commit
d1ec29be7f
@ -1 +1 @@
|
|||||||
make PLAT=linux DEBUG=DEBUG LUAINC_linux_base=/home/diego/build/linux/include LUAPREFIX_linux=/home/diego/build/linux
|
make PLAT=linux DEBUG=DEBUG LUAINC_linux_base=/home/diego/build/ubuntu/include LUAPREFIX_linux=/home/diego/build/ubuntu
|
||||||
|
36
src/makefile
36
src/makefile
@ -31,10 +31,6 @@ MYLDFLAGS=
|
|||||||
# for testing and debugging luasocket itself
|
# for testing and debugging luasocket itself
|
||||||
DEBUG?=NODEBUG
|
DEBUG?=NODEBUG
|
||||||
|
|
||||||
# COMPAT: COMPAT NOCOMPAT
|
|
||||||
# when compiling for 5.2, use LUA_COMPAT_MODULE
|
|
||||||
COMPAT?=NOCOMPAT
|
|
||||||
|
|
||||||
# where lua headers are found for macosx builds
|
# where lua headers are found for macosx builds
|
||||||
# LUAINC_macosx:
|
# LUAINC_macosx:
|
||||||
# /opt/local/include
|
# /opt/local/include
|
||||||
@ -81,13 +77,14 @@ LDIR_mingw?=lua/$(LUAV)/lua
|
|||||||
# LUAINC_win32:
|
# LUAINC_win32:
|
||||||
# LUALIB_win32:
|
# LUALIB_win32:
|
||||||
# where lua headers and libraries are found for win32 builds
|
# where lua headers and libraries are found for win32 builds
|
||||||
LUAINC_win32_base?=
|
|
||||||
LUAINC_win32?=$(LUAINC_win32_base)/lua/$(LUAV)
|
|
||||||
PLATFORM_win32?=Release
|
|
||||||
LUAPREFIX_win32?=
|
LUAPREFIX_win32?=
|
||||||
CDIR_win32?=lua/$(LUAV)/$(PLATFORM_win32)
|
LUAINC_win32?=$(LUAPREFIX_win32)/include/lua/$(LUAV)
|
||||||
LDIR_win32?=lua/$(LUAV)/$(PLATFORM_win32)/lua
|
PLATFORM_win32?=Release
|
||||||
LUALIB_win32?=$(LUAPREFIX_win32)/lua/$(LUAV)/$(PLATFORM_win32)
|
CDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)
|
||||||
|
LDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)/lua
|
||||||
|
LUALIB_win32?=$(LUAPREFIX_win32)/lib/lua/$(LUAV)/$(PLATFORM_win32)
|
||||||
|
LUALIBNAME_win32?=lua$(subst .,,$(LUAV)).lib
|
||||||
|
|
||||||
|
|
||||||
# prefix: /usr/local /usr /opt/local /sw
|
# prefix: /usr/local /usr /opt/local /sw
|
||||||
# the top of the default install tree
|
# the top of the default install tree
|
||||||
@ -143,7 +140,7 @@ PLATS= macosx linux win32 mingw
|
|||||||
SO_macosx=so
|
SO_macosx=so
|
||||||
O_macosx=o
|
O_macosx=o
|
||||||
CC_macosx=gcc
|
CC_macosx=gcc
|
||||||
DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN -DLUA_$(COMPAT)_MODULE \
|
DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN \
|
||||||
-DLUASOCKET_API='__attribute__((visibility("default")))' \
|
-DLUASOCKET_API='__attribute__((visibility("default")))' \
|
||||||
-DUNIX_API='__attribute__((visibility("default")))' \
|
-DUNIX_API='__attribute__((visibility("default")))' \
|
||||||
-DMIME_API='__attribute__((visibility("default")))'
|
-DMIME_API='__attribute__((visibility("default")))'
|
||||||
@ -159,7 +156,7 @@ SOCKET_macosx=usocket.o
|
|||||||
SO_linux=so
|
SO_linux=so
|
||||||
O_linux=o
|
O_linux=o
|
||||||
CC_linux=gcc
|
CC_linux=gcc
|
||||||
DEF_linux=-DLUASOCKET_$(DEBUG) -DLUA_$(COMPAT)_MODULE \
|
DEF_linux=-DLUASOCKET_$(DEBUG) \
|
||||||
-DLUASOCKET_API='__attribute__((visibility("default")))' \
|
-DLUASOCKET_API='__attribute__((visibility("default")))' \
|
||||||
-DUNIX_API='__attribute__((visibility("default")))' \
|
-DUNIX_API='__attribute__((visibility("default")))' \
|
||||||
-DMIME_API='__attribute__((visibility("default")))'
|
-DMIME_API='__attribute__((visibility("default")))'
|
||||||
@ -175,7 +172,7 @@ SOCKET_linux=usocket.o
|
|||||||
SO_freebsd=so
|
SO_freebsd=so
|
||||||
O_freebsd=o
|
O_freebsd=o
|
||||||
CC_freebsd=gcc
|
CC_freebsd=gcc
|
||||||
DEF_freebsd=-DLUASOCKET_$(DEBUG) -DLUA_$(COMPAT)_MODULE \
|
DEF_freebsd=-DLUASOCKET_$(DEBUG) \
|
||||||
-DLUASOCKET_API='__attribute__((visibility("default")))' \
|
-DLUASOCKET_API='__attribute__((visibility("default")))' \
|
||||||
-DUNIX_API='__attribute__((visibility("default")))' \
|
-DUNIX_API='__attribute__((visibility("default")))' \
|
||||||
-DMIME_API='__attribute__((visibility("default")))'
|
-DMIME_API='__attribute__((visibility("default")))'
|
||||||
@ -191,7 +188,7 @@ SOCKET_freebsd=usocket.o
|
|||||||
SO_mingw=dll
|
SO_mingw=dll
|
||||||
O_mingw=o
|
O_mingw=o
|
||||||
CC_mingw=gcc
|
CC_mingw=gcc
|
||||||
DEF_mingw= -DLUASOCKET_INET_PTON -DLUASOCKET_$(DEBUG) -DLUA_$(COMPAT)_MODULE \
|
DEF_mingw= -DLUASOCKET_INET_PTON -DLUASOCKET_$(DEBUG) \
|
||||||
-DWINVER=0x0501 -DLUASOCKET_API='__declspec(dllexport)' \
|
-DWINVER=0x0501 -DLUASOCKET_API='__declspec(dllexport)' \
|
||||||
-DMIME_API='__declspec(dllexport)'
|
-DMIME_API='__declspec(dllexport)'
|
||||||
CFLAGS_mingw= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \
|
CFLAGS_mingw= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \
|
||||||
@ -209,8 +206,7 @@ O_win32=obj
|
|||||||
CC_win32=cl
|
CC_win32=cl
|
||||||
DEF_win32= //D "WIN32" //D "NDEBUG" //D "_WINDOWS" //D "_USRDLL" \
|
DEF_win32= //D "WIN32" //D "NDEBUG" //D "_WINDOWS" //D "_USRDLL" \
|
||||||
//D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \
|
//D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \
|
||||||
//D "_WINDLL" //D "LUA_$(COMPAT)_MODULE" \
|
//D "_WINDLL" //D "MIME_API=__declspec(dllexport)" \
|
||||||
//D "MIME_API=__declspec(dllexport)" \
|
|
||||||
//D "LUASOCKET_$(DEBUG)"
|
//D "LUASOCKET_$(DEBUG)"
|
||||||
CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo
|
CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo
|
||||||
LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \
|
LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \
|
||||||
@ -218,14 +214,14 @@ LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \
|
|||||||
//MANIFESTUAC:"level='asInvoker' uiAccess='false'" \
|
//MANIFESTUAC:"level='asInvoker' uiAccess='false'" \
|
||||||
//SUBSYSTEM:WINDOWS //OPT:REF //OPT:ICF //DYNAMICBASE:NO \
|
//SUBSYSTEM:WINDOWS //OPT:REF //OPT:ICF //DYNAMICBASE:NO \
|
||||||
//MACHINE:X86 /LIBPATH:"$(shell cmd //c echo $(LUALIB))" \
|
//MACHINE:X86 /LIBPATH:"$(shell cmd //c echo $(LUALIB))" \
|
||||||
lua$(subst .,,$(LUAV)).lib ws2_32.lib //OUT:
|
$(LUALIBNAME_win32) ws2_32.lib //OUT:
|
||||||
LD_win32=cl
|
LD_win32=cl
|
||||||
SOCKET_win32=wsocket.obj
|
SOCKET_win32=wsocket.obj
|
||||||
|
|
||||||
.SUFFIXES: .obj
|
.SUFFIXES: .obj
|
||||||
|
|
||||||
.c.obj:
|
.c.obj:
|
||||||
$(CC) $(LUASOCKET_CFLAGS) //Fo"$@" //c $<
|
$(CC) $(CFLAGS) //Fo"$@" //c $<
|
||||||
|
|
||||||
#------
|
#------
|
||||||
# Output file names
|
# Output file names
|
||||||
@ -234,8 +230,8 @@ SO=$(SO_$(PLAT))
|
|||||||
O=$(O_$(PLAT))
|
O=$(O_$(PLAT))
|
||||||
SOCKET_V=3.0-rc1
|
SOCKET_V=3.0-rc1
|
||||||
MIME_V=1.0.3
|
MIME_V=1.0.3
|
||||||
SOCKET_SO=socket.$(SO).$(SOCKET_V)
|
SOCKET_SO=socket-$(SOCKET_V).$(SO)
|
||||||
MIME_SO=mime.$(SO).$(MIME_V)
|
MIME_SO=mime-$(MIME_V).$(SO)
|
||||||
UNIX_SO=unix.$(SO)
|
UNIX_SO=unix.$(SO)
|
||||||
SERIAL_SO=serial.$(SO)
|
SERIAL_SO=serial.$(SO)
|
||||||
SOCKET=$(SOCKET_$(PLAT))
|
SOCKET=$(SOCKET_$(PLAT))
|
||||||
|
@ -21,7 +21,6 @@ typedef t_opt *p_opt;
|
|||||||
/* supported options for setoption */
|
/* supported options for setoption */
|
||||||
int opt_set_dontroute(lua_State *L, p_socket ps);
|
int opt_set_dontroute(lua_State *L, p_socket ps);
|
||||||
int opt_set_broadcast(lua_State *L, p_socket ps);
|
int opt_set_broadcast(lua_State *L, p_socket ps);
|
||||||
int opt_set_reuseaddr(lua_State *L, p_socket ps);
|
|
||||||
int opt_set_tcp_nodelay(lua_State *L, p_socket ps);
|
int opt_set_tcp_nodelay(lua_State *L, p_socket ps);
|
||||||
int opt_set_keepalive(lua_State *L, p_socket ps);
|
int opt_set_keepalive(lua_State *L, p_socket ps);
|
||||||
int opt_set_linger(lua_State *L, p_socket ps);
|
int opt_set_linger(lua_State *L, p_socket ps);
|
||||||
@ -43,6 +42,7 @@ int opt_set_ip6_v6only(lua_State *L, p_socket ps);
|
|||||||
int opt_get_dontroute(lua_State *L, p_socket ps);
|
int opt_get_dontroute(lua_State *L, p_socket ps);
|
||||||
int opt_get_broadcast(lua_State *L, p_socket ps);
|
int opt_get_broadcast(lua_State *L, p_socket ps);
|
||||||
int opt_get_reuseaddr(lua_State *L, p_socket ps);
|
int opt_get_reuseaddr(lua_State *L, p_socket ps);
|
||||||
|
int opt_get_reuseport(lua_State *L, p_socket ps);
|
||||||
int opt_get_tcp_nodelay(lua_State *L, p_socket ps);
|
int opt_get_tcp_nodelay(lua_State *L, p_socket ps);
|
||||||
int opt_get_keepalive(lua_State *L, p_socket ps);
|
int opt_get_keepalive(lua_State *L, p_socket ps);
|
||||||
int opt_get_linger(lua_State *L, p_socket ps);
|
int opt_get_linger(lua_State *L, p_socket ps);
|
||||||
|
@ -73,6 +73,7 @@ static luaL_Reg tcp_methods[] = {
|
|||||||
static t_opt optget[] = {
|
static t_opt optget[] = {
|
||||||
{"keepalive", opt_get_keepalive},
|
{"keepalive", opt_get_keepalive},
|
||||||
{"reuseaddr", opt_get_reuseaddr},
|
{"reuseaddr", opt_get_reuseaddr},
|
||||||
|
{"reuseport", opt_get_reuseport},
|
||||||
{"tcp-nodelay", opt_get_tcp_nodelay},
|
{"tcp-nodelay", opt_get_tcp_nodelay},
|
||||||
{"linger", opt_get_linger},
|
{"linger", opt_get_linger},
|
||||||
{"error", opt_get_error},
|
{"error", opt_get_error},
|
||||||
@ -82,6 +83,7 @@ static t_opt optget[] = {
|
|||||||
static t_opt optset[] = {
|
static t_opt optset[] = {
|
||||||
{"keepalive", opt_set_keepalive},
|
{"keepalive", opt_set_keepalive},
|
||||||
{"reuseaddr", opt_set_reuseaddr},
|
{"reuseaddr", opt_set_reuseaddr},
|
||||||
|
{"reuseport", opt_set_reuseport},
|
||||||
{"tcp-nodelay", opt_set_tcp_nodelay},
|
{"tcp-nodelay", opt_set_tcp_nodelay},
|
||||||
{"ipv6-v6only", opt_set_ip6_v6only},
|
{"ipv6-v6only", opt_set_ip6_v6only},
|
||||||
{"linger", opt_set_linger},
|
{"linger", opt_set_linger},
|
||||||
|
13
win32.cmd
13
win32.cmd
@ -1,12 +1 @@
|
|||||||
make PLAT=win32 LUAV=5.2 LUAINC_win32='c:\cygwin\home\diego\build\include' LUALIB_win32='c:\cygwin\home\diego\build\bin\release'
|
make LUAPREFIX_win32='c:\cygwin\home\diego\vc12' LUAV=5.1 PLAT=win32 LUALIBNAME_win32=lualib.lib PLATFORM_win32=Debug install-both
|
||||||
|
|
||||||
#!/bin/sh
|
|
||||||
for p in Release Debug x64/Release x64/Debug; do
|
|
||||||
for el in mime socket; do
|
|
||||||
for e in dll lib; do
|
|
||||||
cp $p/$el/core.$e ../bin/$p/$el/
|
|
||||||
done;
|
|
||||||
done;
|
|
||||||
cp src/ltn12.lua src/socket.lua src/mime.lua ../bin/$p/
|
|
||||||
cp src/http.lua src/url.lua src/tp.lua src/ftp.lua src/headers.lua src/smtp.lua ../bin/$p/socket/
|
|
||||||
done;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user