mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/basicsocket.c (bsock_getpeername): use struct
sockaddr_storage. (bsock_local_address): ditto. (bsock_remote_address): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1463f1dfe7
commit
6245caf58c
2 changed files with 16 additions and 9 deletions
|
@ -1,3 +1,10 @@
|
|||
Tue Feb 10 23:30:32 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/basicsocket.c (bsock_getpeername): use struct
|
||||
sockaddr_storage.
|
||||
(bsock_local_address): ditto.
|
||||
(bsock_remote_address): ditto.
|
||||
|
||||
Tue Feb 10 21:26:33 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/lib/socket.rb (Socket.udp_server_sockets): new method.
|
||||
|
|
|
@ -351,14 +351,14 @@ bsock_getsockname(VALUE sock)
|
|||
static VALUE
|
||||
bsock_getpeername(VALUE sock)
|
||||
{
|
||||
char buf[1024];
|
||||
struct sockaddr_storage buf;
|
||||
socklen_t len = sizeof buf;
|
||||
rb_io_t *fptr;
|
||||
|
||||
GetOpenFile(sock, fptr);
|
||||
if (getpeername(fptr->fd, (struct sockaddr*)buf, &len) < 0)
|
||||
if (getpeername(fptr->fd, (struct sockaddr*)&buf, &len) < 0)
|
||||
rb_sys_fail("getpeername(2)");
|
||||
return rb_str_new(buf, len);
|
||||
return rb_str_new((char*)&buf, len);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -377,14 +377,14 @@ bsock_getpeername(VALUE sock)
|
|||
static VALUE
|
||||
bsock_local_address(VALUE sock)
|
||||
{
|
||||
char buf[1024];
|
||||
struct sockaddr_storage buf;
|
||||
socklen_t len = sizeof buf;
|
||||
rb_io_t *fptr;
|
||||
|
||||
GetOpenFile(sock, fptr);
|
||||
if (getsockname(fptr->fd, (struct sockaddr*)buf, &len) < 0)
|
||||
if (getsockname(fptr->fd, (struct sockaddr*)&buf, &len) < 0)
|
||||
rb_sys_fail("getsockname(2)");
|
||||
return fd_socket_addrinfo(fptr->fd, (struct sockaddr *)buf, len);
|
||||
return fd_socket_addrinfo(fptr->fd, (struct sockaddr *)&buf, len);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -405,14 +405,14 @@ bsock_local_address(VALUE sock)
|
|||
static VALUE
|
||||
bsock_remote_address(VALUE sock)
|
||||
{
|
||||
char buf[1024];
|
||||
struct sockaddr_storage buf;
|
||||
socklen_t len = sizeof buf;
|
||||
rb_io_t *fptr;
|
||||
|
||||
GetOpenFile(sock, fptr);
|
||||
if (getpeername(fptr->fd, (struct sockaddr*)buf, &len) < 0)
|
||||
if (getpeername(fptr->fd, (struct sockaddr*)&buf, &len) < 0)
|
||||
rb_sys_fail("getpeername(2)");
|
||||
return fd_socket_addrinfo(fptr->fd, (struct sockaddr *)buf, len);
|
||||
return fd_socket_addrinfo(fptr->fd, (struct sockaddr *)&buf, len);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue