about summary refs log tree commit homepage
path: root/lib/rainbows/acceptor.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-09-28 17:40:01 -0700
committerEric Wong <normalperson@yhbt.net>2010-09-28 17:40:01 -0700
commitad821f70a2488a91f2be1ac53cb2e64f50743989 (patch)
tree6db4d334106360305ba3b66b643e8694f232fa10 /lib/rainbows/acceptor.rb
parent11c75ec06ce72cea0c760161dc01a196500aa293 (diff)
downloadrainbows-ad821f70a2488a91f2be1ac53cb2e64f50743989.tar.gz
It removes the burden of byte slicing and setting file
descriptor flags.  In some cases, we can remove unnecessary
peeraddr calls, too.
Diffstat (limited to 'lib/rainbows/acceptor.rb')
-rw-r--r--lib/rainbows/acceptor.rb26
1 files changed, 0 insertions, 26 deletions
diff --git a/lib/rainbows/acceptor.rb b/lib/rainbows/acceptor.rb
deleted file mode 100644
index c67bf20..0000000
--- a/lib/rainbows/acceptor.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- encoding: binary -*-
-
-# :enddoc:
-require 'fcntl'
-
-# this should make life easier for Zbatery if compatibility with
-# fcntl-crippled platforms is required (or if FD_CLOEXEC is inherited)
-# and we want to microptimize away fcntl(2) syscalls.
-module Rainbows::Acceptor
-
-  # returns nil if accept fails
-  def sync_accept(sock)
-    rv = sock.accept
-    rv.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
-    rv
-  rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EINTR
-  end
-
-  # returns nil if accept fails
-  def accept(sock)
-    rv = sock.accept_nonblock
-    rv.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
-    rv
-  rescue Errno::EAGAIN, Errno::ECONNABORTED
-  end
-end