diff options
author | Diego Nehab <diego.nehab@gmail.com> | 2015-10-05 10:28:29 +0800 |
---|---|---|
committer | Diego Nehab <diego.nehab@gmail.com> | 2015-10-05 10:28:29 +0800 |
commit | f4b472007324a65109a86e32e03971339b9fe951 (patch) | |
tree | f80a07cb960e2689d4112aeef46b5a2e6bbc42c1 | |
parent | 4110e4125dace9df3a744067066e5dee62670561 (diff) | |
parent | 833333e1311b531ffbf3f7051da1ec5287a682b5 (diff) | |
download | luasocket-f4b472007324a65109a86e32e03971339b9fe951.tar.gz luasocket-f4b472007324a65109a86e32e03971339b9fe951.tar.bz2 luasocket-f4b472007324a65109a86e32e03971339b9fe951.zip |
Merge branch 'tcp_reuseport' of https://github.com/KateAdams/luasocket into KateAdams-tcp_reuseport
-rw-r--r-- | linux.cmd | 2 | ||||
-rw-r--r-- | src/makefile | 36 | ||||
-rw-r--r-- | src/options.h | 2 | ||||
-rw-r--r-- | src/tcp.c | 2 | ||||
-rw-r--r-- | win32.cmd | 13 |
5 files changed, 21 insertions, 34 deletions
@@ -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 |
32 | DEBUG?=NODEBUG | 32 | DEBUG?=NODEBUG |
33 | 33 | ||
34 | # COMPAT: COMPAT NOCOMPAT | ||
35 | # when compiling for 5.2, use LUA_COMPAT_MODULE | ||
36 | COMPAT?=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 |
84 | LUAINC_win32_base?= | ||
85 | LUAINC_win32?=$(LUAINC_win32_base)/lua/$(LUAV) | ||
86 | PLATFORM_win32?=Release | ||
87 | LUAPREFIX_win32?= | 80 | LUAPREFIX_win32?= |
88 | CDIR_win32?=lua/$(LUAV)/$(PLATFORM_win32) | 81 | LUAINC_win32?=$(LUAPREFIX_win32)/include/lua/$(LUAV) |
89 | LDIR_win32?=lua/$(LUAV)/$(PLATFORM_win32)/lua | 82 | PLATFORM_win32?=Release |
90 | LUALIB_win32?=$(LUAPREFIX_win32)/lua/$(LUAV)/$(PLATFORM_win32) | 83 | CDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32) |
84 | LDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)/lua | ||
85 | LUALIB_win32?=$(LUAPREFIX_win32)/lib/lua/$(LUAV)/$(PLATFORM_win32) | ||
86 | LUALIBNAME_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 | |||
143 | SO_macosx=so | 140 | SO_macosx=so |
144 | O_macosx=o | 141 | O_macosx=o |
145 | CC_macosx=gcc | 142 | CC_macosx=gcc |
146 | DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN -DLUA_$(COMPAT)_MODULE \ | 143 | DEF_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 | |||
159 | SO_linux=so | 156 | SO_linux=so |
160 | O_linux=o | 157 | O_linux=o |
161 | CC_linux=gcc | 158 | CC_linux=gcc |
162 | DEF_linux=-DLUASOCKET_$(DEBUG) -DLUA_$(COMPAT)_MODULE \ | 159 | DEF_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 | |||
175 | SO_freebsd=so | 172 | SO_freebsd=so |
176 | O_freebsd=o | 173 | O_freebsd=o |
177 | CC_freebsd=gcc | 174 | CC_freebsd=gcc |
178 | DEF_freebsd=-DLUASOCKET_$(DEBUG) -DLUA_$(COMPAT)_MODULE \ | 175 | DEF_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 | |||
191 | SO_mingw=dll | 188 | SO_mingw=dll |
192 | O_mingw=o | 189 | O_mingw=o |
193 | CC_mingw=gcc | 190 | CC_mingw=gcc |
194 | DEF_mingw= -DLUASOCKET_INET_PTON -DLUASOCKET_$(DEBUG) -DLUA_$(COMPAT)_MODULE \ | 191 | DEF_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)' |
197 | CFLAGS_mingw= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \ | 194 | CFLAGS_mingw= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \ |
@@ -209,8 +206,7 @@ O_win32=obj | |||
209 | CC_win32=cl | 206 | CC_win32=cl |
210 | DEF_win32= //D "WIN32" //D "NDEBUG" //D "_WINDOWS" //D "_USRDLL" \ | 207 | DEF_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)" |
215 | CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo | 211 | CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo |
216 | LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \ | 212 | LDFLAGS_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: |
222 | LD_win32=cl | 218 | LD_win32=cl |
223 | SOCKET_win32=wsocket.obj | 219 | SOCKET_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)) | |||
234 | O=$(O_$(PLAT)) | 230 | O=$(O_$(PLAT)) |
235 | SOCKET_V=3.0-rc1 | 231 | SOCKET_V=3.0-rc1 |
236 | MIME_V=1.0.3 | 232 | MIME_V=1.0.3 |
237 | SOCKET_SO=socket.$(SO).$(SOCKET_V) | 233 | SOCKET_SO=socket-$(SOCKET_V).$(SO) |
238 | MIME_SO=mime.$(SO).$(MIME_V) | 234 | MIME_SO=mime-$(MIME_V).$(SO) |
239 | UNIX_SO=unix.$(SO) | 235 | UNIX_SO=unix.$(SO) |
240 | SERIAL_SO=serial.$(SO) | 236 | SERIAL_SO=serial.$(SO) |
241 | SOCKET=$(SOCKET_$(PLAT)) | 237 | SOCKET=$(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 */ |
22 | int opt_set_dontroute(lua_State *L, p_socket ps); | 22 | int opt_set_dontroute(lua_State *L, p_socket ps); |
23 | int opt_set_broadcast(lua_State *L, p_socket ps); | 23 | int opt_set_broadcast(lua_State *L, p_socket ps); |
24 | int opt_set_reuseaddr(lua_State *L, p_socket ps); | ||
25 | int opt_set_tcp_nodelay(lua_State *L, p_socket ps); | 24 | int opt_set_tcp_nodelay(lua_State *L, p_socket ps); |
26 | int opt_set_keepalive(lua_State *L, p_socket ps); | 25 | int opt_set_keepalive(lua_State *L, p_socket ps); |
27 | int opt_set_linger(lua_State *L, p_socket ps); | 26 | 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); | |||
43 | int opt_get_dontroute(lua_State *L, p_socket ps); | 42 | int opt_get_dontroute(lua_State *L, p_socket ps); |
44 | int opt_get_broadcast(lua_State *L, p_socket ps); | 43 | int opt_get_broadcast(lua_State *L, p_socket ps); |
45 | int opt_get_reuseaddr(lua_State *L, p_socket ps); | 44 | int opt_get_reuseaddr(lua_State *L, p_socket ps); |
45 | int opt_get_reuseport(lua_State *L, p_socket ps); | ||
46 | int opt_get_tcp_nodelay(lua_State *L, p_socket ps); | 46 | int opt_get_tcp_nodelay(lua_State *L, p_socket ps); |
47 | int opt_get_keepalive(lua_State *L, p_socket ps); | 47 | int opt_get_keepalive(lua_State *L, p_socket ps); |
48 | int opt_get_linger(lua_State *L, p_socket ps); | 48 | int opt_get_linger(lua_State *L, p_socket ps); |
@@ -73,6 +73,7 @@ static luaL_Reg tcp_methods[] = { | |||
73 | static t_opt optget[] = { | 73 | static 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[] = { | |||
82 | static t_opt optset[] = { | 83 | static 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}, |
@@ -1,12 +1 @@ | |||
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 | |
2 | |||
3 | #!/bin/sh | ||
4 | for 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/ | ||
12 | done; | ||