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, 3 insertions, 3 deletions
diff --git a/src/tcp.c b/src/tcp.c
index 5c85ae0..ea97320 100644
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -186,9 +186,9 @@ static int meth_accept(lua_State *L)
186 p_tcp server = (p_tcp) auxiliar_checkclass(L, "tcp{server}", 1); 186 p_tcp server = (p_tcp) auxiliar_checkclass(L, "tcp{server}", 1);
187 p_timeout tm = timeout_markstart(&server->tm); 187 p_timeout tm = timeout_markstart(&server->tm);
188 t_socket sock; 188 t_socket sock;
189 int err = socket_accept(&server->sock, &sock, NULL, NULL, tm); 189 const char *err = inet_tryaccept(&server->sock, server->family, &sock, tm);
190 /* if successful, push client socket */ 190 /* if successful, push client socket */
191 if (err == IO_DONE) { 191 if (err == NULL) {
192 p_tcp clnt = (p_tcp) lua_newuserdata(L, sizeof(t_tcp)); 192 p_tcp clnt = (p_tcp) lua_newuserdata(L, sizeof(t_tcp));
193 auxiliar_setclass(L, "tcp{client}", -1); 193 auxiliar_setclass(L, "tcp{client}", -1);
194 /* initialize structure fields */ 194 /* initialize structure fields */
@@ -203,7 +203,7 @@ static int meth_accept(lua_State *L)
203 return 1; 203 return 1;
204 } else { 204 } else {
205 lua_pushnil(L); 205 lua_pushnil(L);
206 lua_pushstring(L, socket_strerror(err)); 206 lua_pushstring(L, err);
207 return 2; 207 return 2;
208 } 208 }
209} 209}