summaryrefslogtreecommitdiff
path: root/test/socket/test_tcp.rb
AgeCommit message (Collapse)Author
2015-12-03* test/ruby/test_mixed_unicode_escapes.rb: fixed typo.hsbt
[fix GH-1122] Patch by @davydovanton * test/ruby/test_object.rb: ditto. * test/socket/test_tcp.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-14* ext/socket/lib/socket.rb: Specify frozen_string_literal: true.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-02use assert_raisenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-12accept_nonblock supports "exception: false"normal
This is analogous to functionality found in IO#read_nonblock and IO#wait_nonblock. Raising exceptions for common failures on non-blocking servers is expensive and makes $DEBUG too noisy. Benchmark results: user system total real default 2.790000 0.870000 3.660000 ( 3.671597) exception: false 1.120000 0.800000 1.920000 ( 1.922032) exception: false (cached arg) 0.820000 0.770000 1.590000 ( 1.589267) --------------------- benchmark script ------------------------ require 'socket' require 'benchmark' require 'tmpdir' nr = 1000000 Dir.mktmpdir('nb_bench') do |path| sock_path = "#{path}/test.sock" s = UNIXServer.new(sock_path) Benchmark.bmbm do |x| x.report("default") do nr.times do begin s.accept_nonblock rescue IO::WaitReadable end end end x.report("exception: false") do nr.times do begin s.accept_nonblock(exception: false) rescue IO::WaitReadable abort "should not raise" end end end x.report("exception: false (cached arg)") do arg = { exception: false } nr.times do begin s.accept_nonblock(arg) rescue IO::WaitReadable abort "should not raise" end end end end end * ext/socket/init.c (rsock_s_accept_nonblock): support exception: false [ruby-core:66385] [Feature #10532] * ext/socket/init.c (rsock_init_socket_init): define new symbols * ext/socket/rubysocket.h: adjust prototype * ext/socket/socket.c (sock_accept_nonblock): support exception: false * ext/openssl/ossl_ssl.c (ossl_ssl_accept_nonblock): ditto * ext/socket/socket.c (Init_socket): adjust accept_nonblock definition * ext/openssl/ossl_ssl.c (Init_ossl_ssl): ditto * ext/socket/tcpserver.c (rsock_init_tcpserver): ditto * ext/socket/unixserver.c (rsock_init_unixserver): ditto * ext/socket/tcpserver.c (tcp_accept_nonblock): adjust rsock_s_accept_nonblock call * ext/socket/unixserver.c (unix_accept_nonblock): ditto * ext/openssl/ossl_ssl.c (ossl_start_ssl): support no_exception * ext/openssl/ossl_ssl.c (ossl_ssl_connect): adjust ossl_start_ssl call * ext/openssl/ossl_ssl.c (ossl_ssl_connect_nonblock): ditto * ext/openssl/ossl_ssl.c (ossl_ssl_accept): ditto * test/socket/test_nonblock.rb (test_accept_nonblock): test for "exception :false" * test/socket/test_tcp.rb (test_accept_nonblock): new test * test/socket/test_unix.rb (test_accept_nonblock): ditto * test/openssl/test_pair.rb (test_accept_nonblock_no_exception): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-28* ext/socket/unixsocket.c (rsock_init_unixsock): Open a socketakr
after path length check. This fixes a fd leak by TestSocket_UNIXSocket#test_too_long_path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-19* test/socket/test_tcp.rb (test_initialize_failure): Use EADDRNOTAVAILakr
to test an error message generated by bind() failure. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-05Use server_port for Windowsnaruse
fix r41686 [Bug #8574] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-28* ext/socket/ipsocket.c (init_inetsock_internal): Don't use localakr
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-04-06* ext/socket: Improve socket exception message to show socket address.akr
[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
2009-02-11rename tests classes.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-02* test/socket/test_tcp.rb (test_recvfrom): already can run on mswin32.usa
* test/socket/test_tcp.rb (test_recvfrom, test_encoding): use IP address instead of host name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-02* test/socket/test_tcp.rb (test_recvfrom, test_encoding): shouldn't assumeusa
that th is not nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-17* ext/socket/socket.c (init_sock): sockets should be binmode.shugo
* test/socket/test_tcp.rb (test_encoding): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-23* test/socket/test_tcp.rb (test_recvfrom): replace an irrelevant testmame
for old behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-18use ML ref. for assertion message.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-01* test/socket/test_tcp.rb (test_recvfrom): same as mswin32 on mswin64.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-31 * Merge YARVko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-17* test/socket/test_tcp.rb (TestTCPSocket::test_recvfrom): typomatz
fixed. [ruby-dev:27123] * string.c (rb_str_substr): should propagate taintness even for empty strings. [ruby-dev:27121] * string.c (rb_str_aref): should infect result if range argument is tainted. [ruby-dev:27121] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-16* ext/syck/rubyext.c (syck_resolver_transfer): remove C++ stylematz
comment (//). [ruby-core:05793] * lib/net/telnet.rb (Net::Telnet::waitfor): replace sysread with readpartial. [ruby-talk:127641] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-09* test/socket/test_socket.rb (test_setsockopt): use SO_LINGER insteadnobu
of SO_BINDTODEVICE. fixed: [ruby-dev:25133] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-07* test/socket/test_tcp.rb (TestTCPSocket#test_recvfrom): merged worker threads.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-07* test/io/nonblock/test_flush.rb (TestIONonblock#test_flush): writenobu
operation ignores EAGAIN. * test/ruby/test_super.rb (TestSuper#test_define_method): test for super from proc. [ruby-core:03856] * test/socket/test_tcp.rb (TestTCPSocket#test_recvfrom): make execution order more precise. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-06* test/socket/test_tcp.rb (TestTCPSocket#test_recvfrom): fix localnobu
variable conflict. [ruby-dev:25083] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-06* process.c (proc_setgroups): [ruby-dev:25081]matz
* re.c (rb_reg_eqq): document fix. [ruby-talk:122541] * io.c (io_fread): take VALUE argument. * ext/socket/socket.c (sock_connect): use rb_str_new4(). [ruby-dev:25052] * eval.c (rb_yield_0): [ruby-dev:25051] * io.c (io_write): remove rb_str_locktmp(). [ruby-dev:25050] * io.c (io_fwrite): takes VALUE string as an argument. [ruby-dev:25050] * ext/socket/socket.c (sock_connect): remove rb_str_locktmp(). [ruby-dev:25050] * ext/socket/socket.c (udp_connect): [ruby-dev:25045] * ext/socket/socket.c (udp_bind): ditto. * ext/socket/socket.c (udp_send): ditto. * ext/socket/socket.c (bsock_send): ditto. * ext/socket/socket.c (s_recvfrom): ditto. * hash.c (rb_hash_hash): should provide "hash" method where "eql?" is redefined. [ruby-talk:122482] * ext/socket/socket.c (bsock_setsockopt): [ruby-dev:25039] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-06* test/socket/test_socket.rb (TestBasicSocket#test_setsockopt):nobu
BasicSocket#setsockopt dumps core. [ruby-dev:25039] * test/socket/test_tcp.rb (TestTCPSocket#test_recvfrom): TCPSocket#recvfrom dumps core. [ruby-dev:24705] * test/socket/test_udp.rb (TestUDPSocket#test_connect): UDPSocket#connect dumps core. [ruby-dev:25045] * test/socket/test_udp.rb (TestUDPSocket#test_bind): UDPSocket#bind dumps core. [ruby-dev:25057] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e