mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/webrick/server.rb (WEBrick::GenericServer#accept_client):
sockets should be non-blocking mode. [ruby-dev:26405] * lib/webrick/utils.rb (WEBrick::Utils.set_non_blocking): new method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ad46d47e6a
commit
8db529ca2b
3 changed files with 16 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
Fri Jul 15 07:58:10 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||
|
||||
* lib/webrick/server.rb (WEBrick::GenericServer#accept_client):
|
||||
sockets should be non-blocking mode. [ruby-dev:26405]
|
||||
|
||||
* lib/webrick/utils.rb (WEBrick::Utils.set_non_blocking): new method.
|
||||
|
||||
Thu Jul 15 00:11:36 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* enum.c (enumeratorize): create new enumerator for current method if
|
||||
|
|
|
@ -146,6 +146,7 @@ module WEBrick
|
|||
begin
|
||||
sock = svr.accept
|
||||
sock.sync = true
|
||||
Utils::set_non_blocking(sock)
|
||||
Utils::set_close_on_exec(sock)
|
||||
rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPROTO => ex
|
||||
# TCP connection was established but RST segment was sent
|
||||
|
|
|
@ -18,6 +18,14 @@ end
|
|||
|
||||
module WEBrick
|
||||
module Utils
|
||||
def set_non_blocking(io)
|
||||
flag = File::NONBLOCK
|
||||
if defined?(Fcntl::F_GETFL)
|
||||
flag |= io.fcntl(Fcntl::F_GETFL)
|
||||
end
|
||||
io.fcntl(Fcntl::F_SETFL, flag)
|
||||
end
|
||||
module_function :set_non_blocking
|
||||
|
||||
def set_close_on_exec(io)
|
||||
if defined?(Fcntl::FD_CLOEXEC)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue