aboutsummaryrefslogtreecommitdiff
path: root/src/tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tcp.c')
-rw-r--r--src/tcp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tcp.c b/src/tcp.c
index 162d5af..7ff3054 100644
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -228,8 +228,10 @@ static int meth_connect(lua_State *L)
228 228
229static int meth_connected(lua_State *L) 229static int meth_connected(lua_State *L)
230{ 230{
231 p_tcp tcp = (p_tcp) aux_checkclass(L, "tcp{master}", 1); 231 p_tcp tcp;
232 int err = sock_connected(&tcp->sock, &tcp->tm); 232 int err;
233 tcp = (p_tcp) aux_checkclass(L, "tcp{master}", 1);
234 err = sock_connected(&tcp->sock, &tcp->tm);
233 if (err != IO_DONE) { 235 if (err != IO_DONE) {
234 lua_pushnil(L); 236 lua_pushnil(L);
235 lua_pushstring(L, sock_strerror(err)); 237 lua_pushstring(L, sock_strerror(err));