Skip to content
Snippets Groups Projects
Commit 1fd87b61 authored by Dmitry Simonenko's avatar Dmitry Simonenko
Browse files

lua-socket-fixes: use sio_socketname() for socket:tostring().

parent 8d568f4b
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,7 @@ enum { SERVICE_NAME_MAXLEN = 32 }; ...@@ -47,6 +47,7 @@ enum { SERVICE_NAME_MAXLEN = 32 };
- (id) init: (int) fd in: (const char *) format, ...; - (id) init: (int) fd in: (const char *) format, ...;
@end @end
const char *sio_socketname(int fd);
int sio_socket(int domain, int type, int protocol); int sio_socket(int domain, int type, int protocol);
int sio_shutdown(int fd, int how); int sio_shutdown(int fd, int how);
......
...@@ -237,7 +237,7 @@ static int ...@@ -237,7 +237,7 @@ static int
lbox_socket_tostring(struct lua_State *L) lbox_socket_tostring(struct lua_State *L)
{ {
struct bio_socket *s = bio_checksocket(L, -1); 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; return 1;
} }
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include "say.h" #include "say.h"
/** Pretty print socket name and peer (for exceptions) */ /** Pretty print socket name and peer (for exceptions) */
static const char * const char *
sio_socketname(int fd) sio_socketname(int fd)
{ {
static __thread char name[2 * SERVICE_NAME_MAXLEN]; static __thread char name[2 * SERVICE_NAME_MAXLEN];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment