diff options
Diffstat (limited to 'src/tcp.c')
-rw-r--r-- | src/tcp.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -213,13 +213,14 @@ static int meth_connect(lua_State *L) | |||
213 | unsigned short port = (unsigned short) luaL_checknumber(L, 3); | 213 | unsigned short port = (unsigned short) luaL_checknumber(L, 3); |
214 | p_tm tm = tm_markstart(&tcp->tm); | 214 | p_tm tm = tm_markstart(&tcp->tm); |
215 | const char *err = inet_tryconnect(&tcp->sock, address, port, tm); | 215 | const char *err = inet_tryconnect(&tcp->sock, address, port, tm); |
216 | /* have to set the class even if it failed due to non-blocking connects */ | ||
217 | aux_setclass(L, "tcp{client}", 1); | ||
216 | if (err) { | 218 | if (err) { |
217 | lua_pushnil(L); | 219 | lua_pushnil(L); |
218 | lua_pushstring(L, err); | 220 | lua_pushstring(L, err); |
219 | return 2; | 221 | return 2; |
220 | } | 222 | } |
221 | /* turn master object into a client object */ | 223 | /* turn master object into a client object */ |
222 | aux_setclass(L, "tcp{client}", 1); | ||
223 | lua_pushnumber(L, 1); | 224 | lua_pushnumber(L, 1); |
224 | return 1; | 225 | return 1; |
225 | } | 226 | } |