diff --git a/include/sio.h b/include/sio.h index 1b9536a6da3d1d8c9f2f1a0a4c804fd0d3e40396..ba7ad0ab70132dc80b11b3429d38d56c7a68410b 100644 --- a/include/sio.h +++ b/include/sio.h @@ -47,6 +47,7 @@ enum { SERVICE_NAME_MAXLEN = 32 }; - (id) init: (int) fd in: (const char *) format, ...; @end +const char *sio_socketname(int fd); int sio_socket(int domain, int type, int protocol); int sio_shutdown(int fd, int how); diff --git a/src/lua/lua_socket.m b/src/lua/lua_socket.m index 8acba42ae6ae0a2ca4730baf99d74939c63fe2a2..b156584a0ff4e6c16aafb5ec0922c96150284563 100644 --- a/src/lua/lua_socket.m +++ b/src/lua/lua_socket.m @@ -237,7 +237,7 @@ static int lbox_socket_tostring(struct lua_State *L) { struct bio_socket *s = bio_checksocket(L, -1); - lua_pushfstring(L, "%d", s->coio.fd); + lua_pushstring(L, sio_socketname(s->coio.fd)); return 1; } diff --git a/src/sio.m b/src/sio.m index 74b2189ce65ae3b52d6dd5239bba1a0ac1982b7a..b4a683a26a20725ade5a12d1197b151490dc0e86 100644 --- a/src/sio.m +++ b/src/sio.m @@ -38,7 +38,7 @@ #include "say.h" /** Pretty print socket name and peer (for exceptions) */ -static const char * +const char * sio_socketname(int fd) { static __thread char name[2 * SERVICE_NAME_MAXLEN];