1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/socket
normal b9a91334c5 socket: allow exception-free nonblocking sendmsg/recvmsg
As documented before, exceptions are expensive and IO::Wait*able are too
common in socket applications to be the exceptional case.  Datagram
sockets deserve the same API which stream sockets are allowed with
read_nonblock and write_nonblock.

Note: this does not offer a performance advantage under optimal
conditions when both ends are equally matched in speed, but it it
does make debug output cleaner by avoiding exceptions whenever
the receiver slows down.

* ext/socket/ancdata.c (bsock_sendmsg_internal, bsock_recvmsg_internal):
  support "exception: false" kwarg
* ext/socket/init.c (rsock_s_recvfrom_nonblock):
  ditto
* ext/socket/init.c (rsock_s_recvfrom_nonblock): use rsock_opt_false_p
* ext/socket/socket.c (sock_connect_nonblock): ditto
* ext/socket/rubysocket.h (rsock_opt_false_p): new function
* ext/socket/basicsocket.c (bsock_recv_nonblock): update rdoc
* ext/socket/udpsocket.c (udp_recvfrom_nonblock): ditto
* test/socket/test_nonblock.rb: new tests

[ruby-core:69542] [Feature #11229]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-15 19:38:49 +00:00
..
lib stdlib: use IO#wait_*able instead of IO.select when possible 2015-05-06 20:30:43 +00:00
.document
addrinfo.h
ancdata.c socket: allow exception-free nonblocking sendmsg/recvmsg 2015-06-15 19:38:49 +00:00
basicsocket.c socket: allow exception-free nonblocking sendmsg/recvmsg 2015-06-15 19:38:49 +00:00
constants.c use frozen string of symbols 2015-04-14 03:31:28 +00:00
depend Update dependencies. 2014-12-19 13:34:54 +00:00
extconf.rb * ext/socket/extconf.rb: Solaris 11 has struct tcp_info.tcpi_ca_state, 2015-03-25 08:10:14 +00:00
getaddrinfo.c getaddrinfo.c: GHOST vulnerability check 2015-02-08 04:04:32 +00:00
getnameinfo.c
ifaddr.c ifaddr.c: wrapper object before alloc 2015-05-16 12:57:17 +00:00
init.c socket: allow exception-free nonblocking sendmsg/recvmsg 2015-06-15 19:38:49 +00:00
ipsocket.c ipsocket.c: fix merge miss 2015-04-30 07:45:36 +00:00
mkconstants.rb * ext/socket/mkconstants.rb: More constants 2014-05-23 20:54:40 +00:00
option.c * ext/socket/extconf.rb: Solaris 11 has struct tcp_info.tcpi_ca_state, 2015-03-25 08:10:14 +00:00
raddrinfo.c raddrinfo.c: suppress a warning 2015-06-14 23:40:51 +00:00
rubysocket.h socket: allow exception-free nonblocking sendmsg/recvmsg 2015-06-15 19:38:49 +00:00
socket.c socket: allow exception-free nonblocking sendmsg/recvmsg 2015-06-15 19:38:49 +00:00
sockport.h * ext/socket: Bypass getaddrinfo() if node and serv are numeric. 2014-02-19 10:37:43 +00:00
sockssocket.c * ext/socket/basicsocket.c, ext/socket/sockssocket.c: 2014-12-07 10:40:27 +00:00
tcpserver.c accept_nonblock supports "exception: false" 2015-03-12 03:03:04 +00:00
tcpsocket.c
udpsocket.c socket: allow exception-free nonblocking sendmsg/recvmsg 2015-06-15 19:38:49 +00:00
unixserver.c accept_nonblock supports "exception: false" 2015-03-12 03:03:04 +00:00
unixsocket.c * ext/socket/unixsocket.c: [DOC] Fix example to render in HTML 2014-10-11 00:33:08 +00:00