about summary refs log tree commit homepage
path: root/lib/rainbows.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-02-27 18:26:08 -0800
committerEric Wong <normalperson@yhbt.net>2010-02-27 18:26:08 -0800
commit5221350c4c1e9a431fc06f14d3d8a695f8085ce5 (patch)
treeb7156f849b1c560efd00cabe9bf5868a54548277 /lib/rainbows.rb
parente537f067c589c4e0b206878a42169c743d3e3ff2 (diff)
downloadrainbows-5221350c4c1e9a431fc06f14d3d8a695f8085ce5.tar.gz
No point in having extra code around for platforms we
don't care about.
Diffstat (limited to 'lib/rainbows.rb')
-rw-r--r--lib/rainbows.rb35
1 files changed, 12 insertions, 23 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb
index 9260649..f188e18 100644
--- a/lib/rainbows.rb
+++ b/lib/rainbows.rb
@@ -59,30 +59,19 @@ module Rainbows
     end
 
     # returns nil if accept fails
-    if defined?(Fcntl::FD_CLOEXEC)
-      def sync_accept(sock)
-        rv = sock.accept
-        rv.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
-        rv
-      rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EINTR
-      end
-
-      def accept(sock)
-        rv = sock.accept_nonblock
-        rv.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
-        rv
-      rescue Errno::EAGAIN, Errno::ECONNABORTED
-      end
-    else
-      def sync_accept(sock)
-        sock.accept
-      rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EINTR
-      end
+    def sync_accept(sock)
+      rv = sock.accept
+      rv.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
+      rv
+    rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EINTR
+    end
 
-      def accept(sock)
-        sock.accept_nonblock
-      rescue Errno::EAGAIN, Errno::ECONNABORTED
-      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