mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
9536568d3e
commit
5622574976
5 changed files with 17 additions and 5 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
Fri Aug 12 08:17:46 2011 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* 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.
|
||||
|
||||
Fri Aug 12 03:24:35 2011 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* lib/rdoc: Import RDoc 3.9.2. Fixes TIDYLINK for HTML output.
|
||||
|
|
|
@ -105,7 +105,7 @@ init_inetsock_internal(struct inetsock_arg *arg)
|
|||
arg->fd = -1;
|
||||
|
||||
if (type == INET_SERVER) {
|
||||
status = listen(fd, 5);
|
||||
status = listen(fd, SOMAXCONN);
|
||||
if (status < 0) {
|
||||
close(fd);
|
||||
rb_sys_fail("listen(2)");
|
||||
|
|
|
@ -182,7 +182,7 @@ class Addrinfo
|
|||
end
|
||||
|
||||
# creates a listening socket bound to self.
|
||||
def listen(backlog=5)
|
||||
def listen(backlog=Socket::SOMAXCONN)
|
||||
sock = Socket.new(self.pfamily, self.socktype, self.protocol)
|
||||
begin
|
||||
sock.ipv6only! if self.ipv6?
|
||||
|
@ -386,7 +386,7 @@ class Socket < BasicSocket
|
|||
ai_list = Addrinfo.getaddrinfo(host, 0, nil, :STREAM, nil, Socket::AI_PASSIVE)
|
||||
sockets = ip_sockets_port0(ai_list, true)
|
||||
sockets.each {|s|
|
||||
s.listen(5)
|
||||
s.listen(Socket::SOMAXCONN)
|
||||
}
|
||||
sockets
|
||||
ensure
|
||||
|
|
|
@ -688,7 +688,7 @@ INET6_ADDRSTRLEN 46 Maximum length of an IPv6 address string
|
|||
IFNAMSIZ nil Maximum interface name size
|
||||
IF_NAMESIZE nil Maximum interface name size
|
||||
|
||||
SOMAXCONN nil Maximum connection requests that may be queued for a socket
|
||||
SOMAXCONN 5 Maximum connection requests that may be queued for a socket
|
||||
|
||||
SCM_RIGHTS nil Access rights
|
||||
SCM_TIMESTAMP nil Timestamp (timeval)
|
||||
|
|
|
@ -66,7 +66,7 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
|
|||
}
|
||||
|
||||
if (server) {
|
||||
if (listen(fd, 5) < 0) {
|
||||
if (listen(fd, SOMAXCONN) < 0) {
|
||||
close(fd);
|
||||
rb_sys_fail("listen(2)");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue