aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nehab <diego.nehab@gmail.com>2015-10-05 10:28:54 +0800
committerDiego Nehab <diego.nehab@gmail.com>2015-10-05 10:28:54 +0800
commitd1ec29be7f982db75864155dd61a058902e1cae2 (patch)
treef80a07cb960e2689d4112aeef46b5a2e6bbc42c1
parent4110e4125dace9df3a744067066e5dee62670561 (diff)
parentf4b472007324a65109a86e32e03971339b9fe951 (diff)
downloadluasocket-d1ec29be7f982db75864155dd61a058902e1cae2.tar.gz
luasocket-d1ec29be7f982db75864155dd61a058902e1cae2.tar.bz2
luasocket-d1ec29be7f982db75864155dd61a058902e1cae2.zip
Merge branch 'KateAdams-tcp_reuseport'
-rw-r--r--linux.cmd2
-rw-r--r--src/makefile36
-rw-r--r--src/options.h2
-rw-r--r--src/tcp.c2
-rw-r--r--win32.cmd13
5 files changed, 21 insertions, 34 deletions
diff --git a/linux.cmd b/linux.cmd
index bd59adc..6c6636b 100644
--- a/linux.cmd
+++ b/linux.cmd
@@ -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
diff --git a/src/makefile b/src/makefile
index 2704a92..3e8c128 100644
--- a/src/makefile
+++ b/src/makefile
@@ -31,10 +31,6 @@ MYLDFLAGS=
31# for testing and debugging luasocket itself 31# for testing and debugging luasocket itself
32DEBUG?=NODEBUG 32DEBUG?=NODEBUG
33 33
34# COMPAT: COMPAT NOCOMPAT
35# when compiling for 5.2, use LUA_COMPAT_MODULE
36COMPAT?=NOCOMPAT
37
38# where lua headers are found for macosx builds 34# where lua headers are found for macosx builds
39# LUAINC_macosx: 35# LUAINC_macosx:
40# /opt/local/include 36# /opt/local/include
@@ -81,13 +77,14 @@ LDIR_mingw?=lua/$(LUAV)/lua
81# LUAINC_win32: 77# LUAINC_win32:
82# LUALIB_win32: 78# LUALIB_win32:
83# where lua headers and libraries are found for win32 builds 79# where lua headers and libraries are found for win32 builds
84LUAINC_win32_base?=
85LUAINC_win32?=$(LUAINC_win32_base)/lua/$(LUAV)
86PLATFORM_win32?=Release
87LUAPREFIX_win32?= 80LUAPREFIX_win32?=
88CDIR_win32?=lua/$(LUAV)/$(PLATFORM_win32) 81LUAINC_win32?=$(LUAPREFIX_win32)/include/lua/$(LUAV)
89LDIR_win32?=lua/$(LUAV)/$(PLATFORM_win32)/lua 82PLATFORM_win32?=Release
90LUALIB_win32?=$(LUAPREFIX_win32)/lua/$(LUAV)/$(PLATFORM_win32) 83CDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)
84LDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)/lua
85LUALIB_win32?=$(LUAPREFIX_win32)/lib/lua/$(LUAV)/$(PLATFORM_win32)
86LUALIBNAME_win32?=lua$(subst .,,$(LUAV)).lib
87
91 88
92# prefix: /usr/local /usr /opt/local /sw 89# prefix: /usr/local /usr /opt/local /sw
93# the top of the default install tree 90# the top of the default install tree
@@ -143,7 +140,7 @@ PLATS= macosx linux win32 mingw
143SO_macosx=so 140SO_macosx=so
144O_macosx=o 141O_macosx=o
145CC_macosx=gcc 142CC_macosx=gcc
146DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN -DLUA_$(COMPAT)_MODULE \ 143DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN \
147 -DLUASOCKET_API='__attribute__((visibility("default")))' \ 144 -DLUASOCKET_API='__attribute__((visibility("default")))' \
148 -DUNIX_API='__attribute__((visibility("default")))' \ 145 -DUNIX_API='__attribute__((visibility("default")))' \
149 -DMIME_API='__attribute__((visibility("default")))' 146 -DMIME_API='__attribute__((visibility("default")))'
@@ -159,7 +156,7 @@ SOCKET_macosx=usocket.o
159SO_linux=so 156SO_linux=so
160O_linux=o 157O_linux=o
161CC_linux=gcc 158CC_linux=gcc
162DEF_linux=-DLUASOCKET_$(DEBUG) -DLUA_$(COMPAT)_MODULE \ 159DEF_linux=-DLUASOCKET_$(DEBUG) \
163 -DLUASOCKET_API='__attribute__((visibility("default")))' \ 160 -DLUASOCKET_API='__attribute__((visibility("default")))' \
164 -DUNIX_API='__attribute__((visibility("default")))' \ 161 -DUNIX_API='__attribute__((visibility("default")))' \
165 -DMIME_API='__attribute__((visibility("default")))' 162 -DMIME_API='__attribute__((visibility("default")))'
@@ -175,7 +172,7 @@ SOCKET_linux=usocket.o
175SO_freebsd=so 172SO_freebsd=so
176O_freebsd=o 173O_freebsd=o
177CC_freebsd=gcc 174CC_freebsd=gcc
178DEF_freebsd=-DLUASOCKET_$(DEBUG) -DLUA_$(COMPAT)_MODULE \ 175DEF_freebsd=-DLUASOCKET_$(DEBUG) \
179 -DLUASOCKET_API='__attribute__((visibility("default")))' \ 176 -DLUASOCKET_API='__attribute__((visibility("default")))' \
180 -DUNIX_API='__attribute__((visibility("default")))' \ 177 -DUNIX_API='__attribute__((visibility("default")))' \
181 -DMIME_API='__attribute__((visibility("default")))' 178 -DMIME_API='__attribute__((visibility("default")))'
@@ -191,7 +188,7 @@ SOCKET_freebsd=usocket.o
191SO_mingw=dll 188SO_mingw=dll
192O_mingw=o 189O_mingw=o
193CC_mingw=gcc 190CC_mingw=gcc
194DEF_mingw= -DLUASOCKET_INET_PTON -DLUASOCKET_$(DEBUG) -DLUA_$(COMPAT)_MODULE \ 191DEF_mingw= -DLUASOCKET_INET_PTON -DLUASOCKET_$(DEBUG) \
195 -DWINVER=0x0501 -DLUASOCKET_API='__declspec(dllexport)' \ 192 -DWINVER=0x0501 -DLUASOCKET_API='__declspec(dllexport)' \
196 -DMIME_API='__declspec(dllexport)' 193 -DMIME_API='__declspec(dllexport)'
197CFLAGS_mingw= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \ 194CFLAGS_mingw= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \
@@ -209,8 +206,7 @@ O_win32=obj
209CC_win32=cl 206CC_win32=cl
210DEF_win32= //D "WIN32" //D "NDEBUG" //D "_WINDOWS" //D "_USRDLL" \ 207DEF_win32= //D "WIN32" //D "NDEBUG" //D "_WINDOWS" //D "_USRDLL" \
211 //D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \ 208 //D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \
212 //D "_WINDLL" //D "LUA_$(COMPAT)_MODULE" \ 209 //D "_WINDLL" //D "MIME_API=__declspec(dllexport)" \
213 //D "MIME_API=__declspec(dllexport)" \
214 //D "LUASOCKET_$(DEBUG)" 210 //D "LUASOCKET_$(DEBUG)"
215CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo 211CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo
216LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \ 212LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \
@@ -218,14 +214,14 @@ LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \
218 //MANIFESTUAC:"level='asInvoker' uiAccess='false'" \ 214 //MANIFESTUAC:"level='asInvoker' uiAccess='false'" \
219 //SUBSYSTEM:WINDOWS //OPT:REF //OPT:ICF //DYNAMICBASE:NO \ 215 //SUBSYSTEM:WINDOWS //OPT:REF //OPT:ICF //DYNAMICBASE:NO \
220 //MACHINE:X86 /LIBPATH:"$(shell cmd //c echo $(LUALIB))" \ 216 //MACHINE:X86 /LIBPATH:"$(shell cmd //c echo $(LUALIB))" \
221 lua$(subst .,,$(LUAV)).lib ws2_32.lib //OUT: 217 $(LUALIBNAME_win32) ws2_32.lib //OUT:
222LD_win32=cl 218LD_win32=cl
223SOCKET_win32=wsocket.obj 219SOCKET_win32=wsocket.obj
224 220
225.SUFFIXES: .obj 221.SUFFIXES: .obj
226 222
227.c.obj: 223.c.obj:
228 $(CC) $(LUASOCKET_CFLAGS) //Fo"$@" //c $< 224 $(CC) $(CFLAGS) //Fo"$@" //c $<
229 225
230#------ 226#------
231# Output file names 227# Output file names
@@ -234,8 +230,8 @@ SO=$(SO_$(PLAT))
234O=$(O_$(PLAT)) 230O=$(O_$(PLAT))
235SOCKET_V=3.0-rc1 231SOCKET_V=3.0-rc1
236MIME_V=1.0.3 232MIME_V=1.0.3
237SOCKET_SO=socket.$(SO).$(SOCKET_V) 233SOCKET_SO=socket-$(SOCKET_V).$(SO)
238MIME_SO=mime.$(SO).$(MIME_V) 234MIME_SO=mime-$(MIME_V).$(SO)
239UNIX_SO=unix.$(SO) 235UNIX_SO=unix.$(SO)
240SERIAL_SO=serial.$(SO) 236SERIAL_SO=serial.$(SO)
241SOCKET=$(SOCKET_$(PLAT)) 237SOCKET=$(SOCKET_$(PLAT))
diff --git a/src/options.h b/src/options.h
index ad1b00d..19ba0df 100644
--- a/src/options.h
+++ b/src/options.h
@@ -21,7 +21,6 @@ typedef t_opt *p_opt;
21/* supported options for setoption */ 21/* supported options for setoption */
22int opt_set_dontroute(lua_State *L, p_socket ps); 22int opt_set_dontroute(lua_State *L, p_socket ps);
23int opt_set_broadcast(lua_State *L, p_socket ps); 23int opt_set_broadcast(lua_State *L, p_socket ps);
24int opt_set_reuseaddr(lua_State *L, p_socket ps);
25int opt_set_tcp_nodelay(lua_State *L, p_socket ps); 24int opt_set_tcp_nodelay(lua_State *L, p_socket ps);
26int opt_set_keepalive(lua_State *L, p_socket ps); 25int opt_set_keepalive(lua_State *L, p_socket ps);
27int opt_set_linger(lua_State *L, p_socket ps); 26int opt_set_linger(lua_State *L, p_socket ps);
@@ -43,6 +42,7 @@ int opt_set_ip6_v6only(lua_State *L, p_socket ps);
43int opt_get_dontroute(lua_State *L, p_socket ps); 42int opt_get_dontroute(lua_State *L, p_socket ps);
44int opt_get_broadcast(lua_State *L, p_socket ps); 43int opt_get_broadcast(lua_State *L, p_socket ps);
45int opt_get_reuseaddr(lua_State *L, p_socket ps); 44int opt_get_reuseaddr(lua_State *L, p_socket ps);
45int opt_get_reuseport(lua_State *L, p_socket ps);
46int opt_get_tcp_nodelay(lua_State *L, p_socket ps); 46int opt_get_tcp_nodelay(lua_State *L, p_socket ps);
47int opt_get_keepalive(lua_State *L, p_socket ps); 47int opt_get_keepalive(lua_State *L, p_socket ps);
48int opt_get_linger(lua_State *L, p_socket ps); 48int opt_get_linger(lua_State *L, p_socket ps);
diff --git a/src/tcp.c b/src/tcp.c
index 7bf1af5..cef9d16 100644
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -73,6 +73,7 @@ static luaL_Reg tcp_methods[] = {
73static t_opt optget[] = { 73static t_opt optget[] = {
74 {"keepalive", opt_get_keepalive}, 74 {"keepalive", opt_get_keepalive},
75 {"reuseaddr", opt_get_reuseaddr}, 75 {"reuseaddr", opt_get_reuseaddr},
76 {"reuseport", opt_get_reuseport},
76 {"tcp-nodelay", opt_get_tcp_nodelay}, 77 {"tcp-nodelay", opt_get_tcp_nodelay},
77 {"linger", opt_get_linger}, 78 {"linger", opt_get_linger},
78 {"error", opt_get_error}, 79 {"error", opt_get_error},
@@ -82,6 +83,7 @@ static t_opt optget[] = {
82static t_opt optset[] = { 83static t_opt optset[] = {
83 {"keepalive", opt_set_keepalive}, 84 {"keepalive", opt_set_keepalive},
84 {"reuseaddr", opt_set_reuseaddr}, 85 {"reuseaddr", opt_set_reuseaddr},
86 {"reuseport", opt_set_reuseport},
85 {"tcp-nodelay", opt_set_tcp_nodelay}, 87 {"tcp-nodelay", opt_set_tcp_nodelay},
86 {"ipv6-v6only", opt_set_ip6_v6only}, 88 {"ipv6-v6only", opt_set_ip6_v6only},
87 {"linger", opt_set_linger}, 89 {"linger", opt_set_linger},
diff --git a/win32.cmd b/win32.cmd
index 48522f0..3045721 100644
--- a/win32.cmd
+++ b/win32.cmd
@@ -1,12 +1 @@
1make 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
2
3#!/bin/sh
4for p in Release Debug x64/Release x64/Debug; do
5 for el in mime socket; do
6 for e in dll lib; do
7 cp $p/$el/core.$e ../bin/$p/$el/
8 done;
9 done;
10 cp src/ltn12.lua src/socket.lua src/mime.lua ../bin/$p/
11 cp src/http.lua src/url.lua src/tp.lua src/ftp.lua src/headers.lua src/smtp.lua ../bin/$p/socket/
12done;