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

153 Коммитов

Автор SHA1 Сообщение Дата
akr 268d1a2244 * ext/socket/lib/socket.rb (family_addrinfo): return the given
addrinfo object.
  Patch by Ippei Obayashi.  [ruby-dev:45095] [Bug #5845]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-09 11:11:24 +00:00
naruse 6e9a14aabe Cent OS 5.6 (2.6.18-238.19.1.el5xen) doesn't correctly work
sendmsg with pktinfo for link-local ipv6 addresses

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-07 23:04:20 +00:00
akr 88f1b8cf0c add test for close-on-exec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-03 11:15:15 +00:00
akr df6a0fe8bb close a socket in test_socket_new.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-03 10:55:26 +00:00
akr 4db0c519f5 * test/socket/test_socket.rb (test_connect_timeout): added a test
based on a patch by Eric Wong.  [ruby-core:38910]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-13 20:58:11 +00:00
akr e504a81ff1 * test/socket/test_unix.rb: don't use Thread.abort_on_exception.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-13 14:12:23 +00:00
akr 9778737d7b * ext/socket/unixsocket.c (unix_send_io): race condition fixed.
(unix_recv_io): ditto.
  fixed by Eric Wong.  [ruby-core:35574]

* test/socket/test_unix.rb: test added for above problem.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-13 14:11:23 +00:00
nobu 7f46fadd9d * lib/test/unit.rb (assert_include): add alias.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-12 14:17:54 +00:00
nobu 58b325366d * thread.c (rb_thread_io_blocking_region): new function to run
blocking region with GIL released, for fd.
* thread.c (rb_thread_fd_close): implement.  [ruby-core:35203]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-12 05:44:23 +00:00
akr 6dea556eb7 * test/socket/test_addrinfo.rb: extract Errno::EADDRINUSE as a method.
* test/socket/test_socket.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-01 12:42:50 +00:00
akr f5ea2822e6 refine an assertion message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-24 13:38:34 +00:00
akr acb8b3f7a9 * ext/socket/raddrinfo.c (ruby_getaddrinfo__darwin): new workaround for
getaddrinfo problem on Mac OS X Snow Leopard.  [ruby-core:29427]
  patch by Wataru Kimura.  [ruby-core:30842]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-23 12:25:07 +00:00
akr 3a4231cdf4 * test/socket/test_socket.rb (test_udp_server): rescue Errno::ENOSYS
for Windows.

* test/socket/test_nonblock.rb (test_sendmsg_nonblock_error): ditto.

  [ruby-dev:41597] reported by Masaya Tarui.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-14 13:46:06 +00:00
usa 520647325b * test/socket/test_addrinfo.rb: ipaddr.rb defines Socket::AF_INET6 as an Object
if the constant is not available.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-19 02:55:38 +00:00
nobu 603363369b * test/socket/test_unix.rb (TestSocket_UNIXSocket#test_recvmsg):
skip if AncillaryData is not available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-28 08:54:07 +00:00
akr 6b11ee7288 call unix_server.close only if unix_server is not nil.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-23 11:41:44 +00:00
akr a967f738c8 * lib/matrix.rb: suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-25 22:08:29 +00:00
akr 666049981f Use UDP for sendmsg/recvmsg tests.
sendmsg/recvmsg doesn't work with SOCK_STREAM on Windows.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-19 08:53:11 +00:00
usa 828d7a368a * test_socket.rb (test_udp_server): cannot check the existance of sendmsg by
respond_to?.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-19 00:48:40 +00:00
akr bdfe1c7f8e fix skip condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-17 22:28:28 +00:00
usa 229b4e4c37 * ext/socket/socket.c (socket_s_ip_address_list): drop inactive
adapters.

	* test/socket/test_{nonblock,addrinfo,socket}.rb: skip some tests on
	  Windows.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-17 13:40:59 +00:00
akr 2f8b6234cd * include/ruby/intern.h (rb_time_num_new): declared.
* time.c (nsec2timev): extracted from time_new_internal.
  (time_new_internal): change argument to VALUE.
  (rb_time_new): follow the argument change.
  (rb_time_nano_new): ditto.
  (rb_time_num_new): new function.

* ext/socket/ancdata.c (ancillary_timestamp): use rb_time_num_new to
  represent struct bintime preciously.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-01 12:11:53 +00:00
akr 32004e3c46 don't use /tmp as example socket path.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-18 14:04:54 +00:00
akr 758f9510a6 use IO::WaitWritable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-19 12:45:40 +00:00
akr c4049f4cb6 * io.c (rb_mWaitReadable): defined.
(rb_mWaitWritable): defined.
  (io_getpartial): extend IO::WaitReadable on EWOULDBLOCK and EAGAIN.
  (rb_io_write_nonblock): extend IO::WaitWritable on EWOULDBLOCK and
  EAGAIN.

* error.c (make_errno_exc): extracted from rb_sys_fail.
  (rb_mod_sys_fail): new function.

* include/ruby/ruby.h (rb_mod_sys_fail): declared.
  (rb_mWaitReadable): declared.
  (rb_mWaitWritable): declared.

* ext/socket/init.c (rsock_s_recvfrom_nonblock): extend
  IO::WaitReadable on EWOULDBLOCK and EAGAIN.
  (rsock_s_accept_nonblock): extend IO::WaitReadable on EWOULDBLOCK,
  EAGAIN, ECONNABORTED and EPROTO.

* ext/socket/socket.c (sock_connect_nonblock): extend IO::WaitWritable
  on EINPROGRESS.

* ext/socket/ancdata.c (bsock_sendmsg_internal): extend
  IO::WaitWritable on EWOULDBLOCK and EAGAIN.
  (bsock_recvmsg_internal): extend IO::WaitReadable on EWOULDBLOCK and
  EAGAIN.

* ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): raise SSLError
  extended by IO::WaitReadable/IO::WaitWritable on
  SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE.

* ext/openssl/ossl.c (ossl_make_error): extracted from ossl_raise.
  (ossl_exc_new): new function.

* ext/openssl/ossl.h (ossl_exc_new): declared.

* lib/net/protocol.rb (rbuf_fill): rescue IO::WaitReadable and
  IO::WaitWritable.

  [ruby-core:22539], [ruby-dev:38140] 



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-19 11:40:38 +00:00
akr ba8fbae364 assert connects doesn't raise.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 06:58:50 +00:00
nobu 287a34ae0d * {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06 03:56:38 +00:00
akr fb5d4ecfb5 * ext/socket/ancdata.c (rsock_discard_cmsg_resource): defined
unconditionally.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-02 12:14:35 +00:00
akr 2ba6eec1fa * ext/socket/ancdata.c (ancillary_unix_rights): check message type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-28 09:29:26 +00:00
akr d8c66c4333 * ext/socket/ancdata.c (bsock_recvmsg_internal): close FDs passed by
SCM_RIGHTS unless :scm_rights=>true is given.
  (discard_cmsg): extracted from rsock_discard_cmsg_resource.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-27 14:23:54 +00:00
akr 7f247b9d0c add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-27 13:10:25 +00:00
akr ecb22ce2c5 * ext/socket/lib/socket.rb (BasicSocket#connect_address): new method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-26 14:15:39 +00:00
akr e6f0b1de89 * ext/socket/option.c (sockopt_level): extracted from sockopt_level_m.
(sockopt_optname): extracted from sockopt_optname_m.
  (sockopt_data): apply StringValue.
  (sockopt_s_linger): new method.
  (sockopt_linger): new method.
  (inspect_linger): show onoff value if it is neither 0 nor 1.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-25 15:26:25 +00:00
akr 56c52c1da8 * ext/socket/ancdata.c (ancillary_s_unix_rights): new method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-25 14:19:24 +00:00
akr e137e939b7 * ext/socket/ancdata.c (ancillary_timestamp): support SCM_BINTIME.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-24 10:56:57 +00:00
akr b404c651d2 * ext/socket/ancdata.c (ancillary_timestamp): new method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-24 10:45:46 +00:00
akr 605cd65904 * ext/socket/ancdata.c (inspect_timespec_as_abstime): new function to
show struct timespec.
  (ancillary_inspect): use it for SCM_TIMESTAMPNS on GNU/Linux.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-23 11:41:38 +00:00
akr 23e286f3fb * ext/socket/ancdata.c (inspect_bintime_as_abstime): new function to
show struct bintime.
  (ancillary_inspect): use it for SCM_BINTIME on FreeBSD.

* ext/socket/mkconstants.rb: define SCM_BINTIME.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-23 11:32:43 +00:00
akr a0e3e8e4d1 * ext/socket/ancdata.c (inspect_timeval_as_abstime): use time_t
variable to avoid a warning on environments which use long as
  tv_sec as NetBSD.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-23 11:21:45 +00:00
akr decee68028 add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 18:14:01 +00:00
akr 9cfe35ad50 * io.c (io_getpartial): error message describes what should be
waited after nonblocking error.
  (rb_io_write_nonblock): ditto.

* ext/socket/init.c (s_recvfrom_nonblock): ditto.
  (s_accept_nonblock): ditto.

* ext/socket/socket.c (sock_connect_nonblock): ditto.

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



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-21 15:57:52 +00:00
akr bed4294451 * ext/socket/ancdata.c (ancillary_unix_rights): method renamed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-19 12:13:38 +00:00
akr 18afbc891c * ext/socket/ancdata.c (ancillary_rights): new method.
(make_io_for_rights): new function to allocate
  IOs for FDs in SCM_RIGHTS message.
  (bsock_recvmsg_internal): use make_io_for_rights.  So the FDs can be
  closed by GC.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-18 18:43:15 +00:00
akr 536adb5d7c care EWOULDBLOCK of accept_nonblock.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-17 11:05:35 +00:00
akr 9ddde2773f add timeout.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 11:06:23 +00:00
akr a61786398a * test/socket/test_socket.rb (test_udp_server): filter out unreachable
addresses.  [ruby-dev:37970]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-12 14:24:11 +00:00
akr 97a922e2ff test only if Socket::AncillaryData exists.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-12 12:45:24 +00:00
akr 3032bdb1d3 test updated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-11 15:29:35 +00:00
akr 3f0d724dc3 * ext/socket/lib/socket.rb (Socket.unix_server_socket): close the
socket when the block exits.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-11 07:54:52 +00:00
akr 0a954e9117 * ext/socket/lib/socket.rb (Socket.unix_server_socket): call the block
if given.  remove the socket file when the block exits.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-11 07:51:53 +00:00