Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Make uv_getsockname() operate on uv_handle_t handles.
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Aug 24, 2011
1 parent 5cae6e4 commit 5202406
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/uv.h
Expand Up @@ -415,7 +415,7 @@ struct uv_connect_s {
};


int uv_getsockname(uv_tcp_t* handle, struct sockaddr* name, int* namelen);
int uv_getsockname(uv_handle_t* handle, struct sockaddr* name, int* namelen);


/*
Expand Down
2 changes: 1 addition & 1 deletion src/uv-unix.c
Expand Up @@ -1116,7 +1116,7 @@ int uv_tcp_connect6(uv_connect_t* req,
}


int uv_getsockname(uv_tcp_t* handle, struct sockaddr* name, int* namelen) {
int uv_getsockname(uv_handle_t* handle, struct sockaddr* name, int* namelen) {
socklen_t socklen;
int saved_errno;

Expand Down
2 changes: 1 addition & 1 deletion src/win/tcp.c
Expand Up @@ -548,7 +548,7 @@ int uv_tcp_connect6(uv_connect_t* req, uv_tcp_t* handle,
}


int uv_getsockname(uv_tcp_t* handle, struct sockaddr* name, int* namelen) {
int uv_getsockname(uv_handle_t* handle, struct sockaddr* name, int* namelen) {
int result;

if (handle->flags & UV_HANDLE_SHUTTING) {
Expand Down
6 changes: 3 additions & 3 deletions test/test-getsockname.c
Expand Up @@ -89,7 +89,7 @@ static void on_connection(uv_stream_t* server, int status) {
r = uv_accept(server, (uv_stream_t*)handle);
ASSERT(r == 0);

status = uv_getsockname((uv_tcp_t*)handle, &sockname, &namelen);
status = uv_getsockname(handle, &sockname, &namelen);
if (status != 0) {
fprintf(stderr, "uv_getsockname error (accepted) %d\n", uv_last_error().code);
}
Expand All @@ -110,7 +110,7 @@ static void on_connect(uv_connect_t* req, int status) {

ASSERT(status == 0);

r = uv_getsockname(&tcp, &sockname, &namelen);
r = uv_getsockname((uv_handle_t*)&tcp, &sockname, &namelen);
if (r != 0) {
fprintf(stderr, "uv_getsockname error (connector) %d\n", uv_last_error().code);
}
Expand Down Expand Up @@ -147,7 +147,7 @@ static int tcp_listener(int port) {
return 1;
}

r = uv_getsockname(&tcpServer, &sockname, &namelen);
r = uv_getsockname((uv_handle_t*)&tcpServer, &sockname, &namelen);
if (r != 0) {
fprintf(stderr, "uv_getsockname error (listening) %d\n", uv_last_error().code);
}
Expand Down

0 comments on commit 5202406

Please sign in to comment.