From 8db529ca2bc2f718ed2b0179ae489342b0d8f01a Mon Sep 17 00:00:00 2001 From: gotoyuzo Date: Thu, 14 Jul 2005 22:59:09 +0000 Subject: * 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 --- lib/webrick/utils.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/webrick/utils.rb') diff --git a/lib/webrick/utils.rb b/lib/webrick/utils.rb index 7283704c1d..cf9da6f2ce 100644 --- a/lib/webrick/utils.rb +++ b/lib/webrick/utils.rb @@ -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) -- cgit v1.2.3