diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-19 00:24:41 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-19 00:24:41 +0000 |
commit | 6ac82d50eecdf9bf55f4234ed3a5449afd7a2992 (patch) | |
tree | 8cd27e814359d60543428a89b104a8528d0e6bf2 /src/tcp.c | |
parent | 3ea92711269153916990d6cd7999bf436775e647 (diff) | |
download | luasocket-6ac82d50eecdf9bf55f4234ed3a5449afd7a2992.tar.gz luasocket-6ac82d50eecdf9bf55f4234ed3a5449afd7a2992.tar.bz2 luasocket-6ac82d50eecdf9bf55f4234ed3a5449afd7a2992.zip |
Added proxy support to http.lua
Changed callback.lua module, but need more work.
Added local connect support.
Diffstat (limited to 'src/tcp.c')
-rw-r--r-- | src/tcp.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -230,15 +230,15 @@ static int meth_bind(lua_State *L) | |||
230 | p_tcp tcp = (p_tcp) aux_checkclass(L, "tcp{master}", 1); | 230 | p_tcp tcp = (p_tcp) aux_checkclass(L, "tcp{master}", 1); |
231 | const char *address = luaL_checkstring(L, 2); | 231 | const char *address = luaL_checkstring(L, 2); |
232 | unsigned short port = (unsigned short) luaL_checknumber(L, 3); | 232 | unsigned short port = (unsigned short) luaL_checknumber(L, 3); |
233 | int backlog = (int) luaL_optnumber(L, 4, 0); | 233 | int backlog = (int) luaL_optnumber(L, 4, 1); |
234 | const char *err = inet_trybind(&tcp->sock, address, port, backlog); | 234 | const char *err = inet_trybind(&tcp->sock, address, port, backlog); |
235 | if (err) { | 235 | if (err) { |
236 | lua_pushnil(L); | 236 | lua_pushnil(L); |
237 | lua_pushstring(L, err); | 237 | lua_pushstring(L, err); |
238 | return 2; | 238 | return 2; |
239 | } | 239 | } |
240 | /* turn master object into a server object */ | 240 | /* turn master object into a server object if there was a listen */ |
241 | aux_setclass(L, "tcp{server}", 1); | 241 | if (backlog > 0) aux_setclass(L, "tcp{server}", 1); |
242 | lua_pushnumber(L, 1); | 242 | lua_pushnumber(L, 1); |
243 | return 1; | 243 | return 1; |
244 | } | 244 | } |