Граф коммитов

33 Коммитов

Автор SHA1 Сообщение Дата
nobu 8c84803d80 IPSocket#inspect
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-14 10:03:43 +00:00
hsbt 4043565023 * ext/socket/*.c: Add proper require for example to work.
[fix GH-1378][ci skip] Patch by @schneems

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-05 03:57:32 +00:00
nobu 61053459cf rsock_addrinfo: specify address family
* ext/socket/rsock_addrinfo (rsock_addrinfo): specify address
  family.  [Fix GH-1052]
* ext/socket/udpsocket.c (udp_connect, udp_bind, udp_send):
  address family by the receiver.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-13 03:14:13 +00:00
nobu 03c19dc555 ipsocket.c: fix merge miss
* ext/socket/ipsocket.c (init_inetsock_internal): fix local
  variable name by merge miss.  [ruby-core:68531] [Bug #10975]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-30 07:45:36 +00:00
nobu db7a4e66e1 ipsocket.c: sys_error
* ext/socket/ipsocket.c (init_inetsock_internal): preserve errno
  before other library calls and use rb_syserr_fail.
  [ruby-core:68531] [Bug #10975]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-30 07:39:46 +00:00
hsbt d9a2b3480e * doc/contributors.rdoc: fix a typo. Patch by @davydovanton
[fix GH-872][ci skip]
* doc/syntax/methods.rdoc: ditto.
* ext/digest/sha2/sha2.c: ditto.
* ext/socket/ipsocket.c: ditto.
* ext/tk/*: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-15 01:37:47 +00:00
akr dd1c3a7509 * ext/socket: Wrap struct addrinfo by struct rb_addrinfo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-19 09:38:24 +00:00
akr 948ce9decb * ext/socket/ipsocket.c (ip_s_getaddress): Don't access freed memory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-19 08:51:33 +00:00
akr 8c55a0a6e4 * ext/socket/ipsocket.c (init_inetsock_internal): Don't try mismached
address family if already failed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-01 15:43:21 +00:00
akr b7fd00c8fa * ext/socket/ipsocket.c (init_inetsock_internal): Use an address
family for local address wihch is different to the remote
  address if no other choice.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-01 11:05:47 +00:00
akr a5fcce2820 * ext/socket/ipsocket.c (init_inetsock_internal): Don't use local
addresses which address family is different to remote address.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-28 03:16:07 +00:00
akr d933fb2296 * ext/socket: Improve socket exception message to show socket address.
[ruby-core:45617] [Feature #6583] proposed Eric Hodel.

* ext/socket/rubysocket.h (rsock_sys_fail_host_port): Declared.
  (rsock_sys_fail_path): Ditto.
  (rsock_sys_fail_sockaddr): Ditto.

* ext/socket/udpsocket.c (udp_connect): Use rsock_sys_fail_host_port.
  (udp_bind): Ditto.
  (udp_send): Ditto.

* ext/socket/init.c (rsock_init_sock): Specify a string for rb_sys_fail
  argument.
  (make_fd_nonblock): Ditto.
  (rsock_s_accept): Ditto.

* ext/socket/ipsocket.c (init_inetsock_internal): Use
  rsock_sys_fail_host_port.

* ext/socket/socket.c (rsock_sys_fail_host_port): Defined.
  (rsock_sys_fail_path): Ditto.
  (rsock_sys_fail_sockaddr): Ditto.
  (setup_domain_and_type): Use rsock_sys_fail_sockaddr.
  (sock_connect_nonblock): Ditto.
  (sock_bind): Ditto.
  (sock_gethostname): Specify a string for rb_sys_fail argument.
  (socket_s_ip_address_list): Ditto.

* ext/socket/basicsocket.c (bsock_shutdown): Specify a string for
  rb_sys_fail argument.
  (bsock_setsockopt): Use rsock_sys_fail_path.
  (bsock_getsockopt): Ditto.
  (bsock_getpeereid): Refine the argument for rb_sys_fail.

* ext/socket/unixsocket.c (rsock_init_unixsock): Use
  rsock_sys_fail_path.
  (unix_path): Ditto.
  (unix_send_io): Ditto.
  (unix_recv_io): Ditto.
  (unix_addr): Ditto.
  (unix_peeraddr): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-06 02:39:44 +00:00
akr c89844dbc5 * ext/socket: define and use union_sockaddr instead of struct
sockaddr_storage for less casts.

* ext/socket/rubysocket.h (union_sockaddr): defined.

* ext/socket/socket.c (sock_accept): use union_sockaddr.
  (sock_accept_nonblock): ditto.
  (sock_sysaccept): ditto.
  (sock_s_getnameinfo): ditto.

* ext/socket/basicsocket.c (bsock_getsockname): ditto.
  (bsock_getpeername): ditto.
  (bsock_local_address): ditto.
  (bsock_remote_address): ditto.

* ext/socket/ancdata.c (bsock_recvmsg_internal): ditto.

* ext/socket/init.c (recvfrom_arg): ditto.
  (recvfrom_blocking): ditto.
  (rsock_s_recvfrom): ditto.
  (rsock_s_recvfrom_nonblock): ditto.
  (rsock_getfamily): ditto.

* ext/socket/raddrinfo.c (rb_addrinfo_t): ditto.
  (ai_get_afamily): ditto.
  (inspect_sockaddr): ditto.
  (addrinfo_mdump): ditto.
  (addrinfo_mload): ditto.
  (addrinfo_getnameinfo): ditto.
  (addrinfo_ip_port): ditto.
  (extract_in_addr): ditto.
  (addrinfo_ipv6_to_ipv4): ditto.
  (addrinfo_unix_path): ditto.

* ext/socket/tcpserver.c (tcp_accept): ditto.
  (tcp_accept_nonblock): ditto.
  (tcp_sysaccept): ditto.

* ext/socket/ipsocket.c (ip_addr): ditto.
  (ip_peeraddr): ditto.
  (ip_s_getaddress): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-24 17:51:17 +00:00
akr 18a8046d1c * ext/socket: always operate length of socket addess companion with
socket address. 

* ext/socket/rubysocket.h (rsock_make_ipaddr): add an argument for
  socket address length.
  (rsock_ipaddr): ditto.

* ext/socket/ipsocket.c (ip_addr): pass length to rsock_ipaddr.
  (ip_peeraddr): ditto.
  (ip_s_getaddress): pass length to rsock_make_ipaddr.

* ext/socket/socket.c (make_addrinfo): pass length to rsock_ipaddr.
  (sock_s_getnameinfo): pass actual address length to rb_getnameinfo.
  (sock_s_unpack_sockaddr_in): pass length to rsock_make_ipaddr.
  
* ext/socket/init.c (rsock_s_recvfrom): pass length to rsock_ipaddr.
  (rsock_s_recvfrom_nonblock): ditto.

* ext/socket/tcpsocket.c (tcp_sockaddr): pass length to
  rsock_make_ipaddr.

* ext/socket/raddrinfo.c (make_ipaddr0): add an argument for socket
  address length.  pass the length to rb_getnameinfo.
  (rsock_ipaddr): ditto.
  (rsock_make_ipaddr): add an argument for socket address length. 
  pass the length to make_ipaddr0.
  (make_inetaddr): pass length to make_ipaddr0.
  a local variable renamed.
  (host_str): a local variable renamed.
  (port_str): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-14 11:28:49 +00:00
zzak d2ddd30a3f * ext/socket/ipsocket.c (IPSocket#peeraddr): Fix example
[ruby-core:46429] [Bug #6732]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-23 01:46:51 +00:00
drbrain 1297942451 * ext/socket: Make Socket documentation appear. Add documentation for
Socket, TCPServer, SOCKSSocket.  Patch by Sylvain Daubert.
  [Ruby 1.9 - Feature #5182]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-15 23:08:39 +00:00
akr 5622574976 * ext/socket/ipsocket.c (init_inetsock_internal): use SOMAXCONN for
listen backlog.

* ext/socket/unixsocket.c (rsock_init_unixsock): ditto.

* ext/socket/lib/socket.rb (Addrinfo#listen): ditto.
  (Socket.tcp_server_sockets_port0): ditto.

* ext/socket/mkconstants.rb: define SOMAXCONN as 5 if not available.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-11 23:20:15 +00:00
akr 94a5335148 * ext/socket/ipsocket.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-27 14:16:50 +00:00
akr bc843e4b7d * ext/socket/ipsocket.c (init_inetsock_internal): raise an error on
listen(2) failure.
  reported by Xavier Shay.  [ruby-core:35505]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-16 11:42:03 +00:00
nobu 4822d20cc5 * ext/socket: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-28 08:14:13 +00:00
nobu 977267c2e0 * ext/**/*.[ch]: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-22 08:04:13 +00:00
mame 79a3b7797f * ext/socket/ipsocket.c (init_inetsock_internal),
ext/socket/unixsocket.c (rsock_init_unixsock): check the result of
  listen(2).  based on a patch from Mike Pomraning.  [ruby-core:23698]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-09 14:53:19 +00:00
akr a4fa54a10a * ext/socket: use rsock_ prefix for internal initialization functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-22 16:15:21 +00:00
akr 652484598d update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-22 09:45:57 +00:00
akr 1561d3fb8b update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-22 03:33:14 +00:00
akr daa739876f * ext/socket: make sources rdoc friendly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-21 10:50:52 +00:00
nobu af2f1bf4f9 * ext/socket/ipsocket.c (ip_addr, ip_peeraddr),
ext/socket/socket.c (sock_s_getaddrinfo): added optional
  reverse_lookup flag.  [ruby-core:28007]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-06 02:35:11 +00:00
akr 9c4ac94a8e fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-04 12:02:37 +00:00
usa ce1ef5b604 * ext/socket/ipsocket.c (init_inetsock_internal): drop IPv6 addresses
if INET6 is not defined.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-22 08:42:12 +00:00
akr 172d208789 * ext/socket/ (rsock_make_hostent): renamed from sock_make_hostent.
(rsock_addrinfo): renamed from sock_addrinfo.
  (rsock_getaddrinfo): renamed from sock_getaddrinfo.
  (rsock_socket): renamed from ruby_socket.
  (rsock_sock_s_socketpair): renamed from sock_s_socketpair.
  (rsock_connect): renamed from ruby_connect.

* ext/socket/socket.c (sock_listen): make it static.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-01 06:48:22 +00:00
akr c49f05dd79 * ext/socket: add rsock_prefix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-01 06:30:41 +00:00
akr fa65ca097b * ext/socket/ipsocket.c (Init_ipsocket): undef getpeereid at IPSocket.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-11 02:48:08 +00:00
akr 97cbab78dc * ext/socket: split files for each class.
* ext/socket/rubysocket.h: common header.

* ext/socket/basicsocket.c: new file for BasicSocket.

* ext/socket/ipsocket.c: new file for IPSocket.

* ext/socket/tcpsocket.c: new file for TCPSocket.

* ext/socket/tcpserver.c: new file for TCPServer.

* ext/socket/sockssocket.c: new file for SOCKSSocket.

* ext/socket/udpsocket.c: new file for UDPSocket.

* ext/socket/unixsocket.c: new file for UNIXSocket.

* ext/socket/unixserver.c: new file for UNIXServer.

* ext/socket/socket.c: now for Socket.

* ext/socket/raddrinfo.c: new file for AddrInfo and name resolution.

* ext/socket/constants.c: new file for constants.

* ext/socket/init.c: new file for utilities.

* ext/socket/mkconstants.rb: export *_to_int.

* ext/socket/extconf.rb: add new object files.

* ext/socket/depend: add dependencies for new files.

* ext/.document: add new files.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-17 04:11:27 +00:00