aboutsummaryrefslogtreecommitdiff
path: root/src/tcp.c
diff options
context:
space:
mode:
authorDiego Nehab <diego@impa.br>2012-12-11 16:35:27 -0200
committerDiego Nehab <diego@impa.br>2012-12-11 16:35:27 -0200
commit618ce43ee3950b80aca1fde0a5b12e6e13627f1b (patch)
treefc97079e13e071593086a3d6aa5b090b96c744a3 /src/tcp.c
parent66670c354146feb8c9603f10682fabcba44a05a9 (diff)
downloadluasocket-618ce43ee3950b80aca1fde0a5b12e6e13627f1b.tar.gz
luasocket-618ce43ee3950b80aca1fde0a5b12e6e13627f1b.tar.bz2
luasocket-618ce43ee3950b80aca1fde0a5b12e6e13627f1b.zip
Fix socket_accept usage to depend on family.
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}