diff options
Diffstat (limited to 'src/tcp.c')
-rw-r--r-- | src/tcp.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -257,7 +257,10 @@ static int meth_connect(lua_State *L) | |||
257 | p_tcp tcp = (p_tcp) aux_checkclass(L, "tcp{master}", 1); | 257 | p_tcp tcp = (p_tcp) aux_checkclass(L, "tcp{master}", 1); |
258 | const char *address = luaL_checkstring(L, 2); | 258 | const char *address = luaL_checkstring(L, 2); |
259 | unsigned short port = (unsigned short) luaL_checknumber(L, 3); | 259 | unsigned short port = (unsigned short) luaL_checknumber(L, 3); |
260 | const char *err = inet_tryconnect(&tcp->sock, address, port); | 260 | p_tm tm = &tcp->tm; |
261 | const char *err; | ||
262 | tm_markstart(tm); | ||
263 | err = inet_tryconnect(&tcp->sock, address, port, tm_getfailure(tm)); | ||
261 | if (err) { | 264 | if (err) { |
262 | lua_pushnil(L); | 265 | lua_pushnil(L); |
263 | lua_pushstring(L, err); | 266 | lua_pushstring(L, err); |
@@ -326,7 +329,7 @@ static int meth_getsockname(lua_State *L) | |||
326 | \*-------------------------------------------------------------------------*/ | 329 | \*-------------------------------------------------------------------------*/ |
327 | static int meth_settimeout(lua_State *L) | 330 | static int meth_settimeout(lua_State *L) |
328 | { | 331 | { |
329 | p_tcp tcp = (p_tcp) aux_checkgroup(L, "tcp{client,server}", 1); | 332 | p_tcp tcp = (p_tcp) aux_checkgroup(L, "tcp{any}", 1); |
330 | return tm_meth_settimeout(L, &tcp->tm); | 333 | return tm_meth_settimeout(L, &tcp->tm); |
331 | } | 334 | } |
332 | 335 | ||