diff options
author | Eric Wong <e@80x24.org> | 2022-01-23 21:16:02 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-01-23 21:16:47 +0000 |
commit | 773bfa23614aa483e590d635d732cc523fc38f37 (patch) | |
tree | 0f6b5c5b574b2b64648027521f05e15cb9c72734 /lib/dtas/unix_server.rb | |
parent | eab2f44b4d02ee5e468a41d50275b6506adf83d6 (diff) | |
download | dtas-773bfa23614aa483e590d635d732cc523fc38f37.tar.gz |
get rid of DTAS::Nonblock wrapper for Ruby <= 2.0
We require 2.3+, nowadays, so jettison a bunch of code.
Diffstat (limited to 'lib/dtas/unix_server.rb')
-rw-r--r-- | lib/dtas/unix_server.rb | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/dtas/unix_server.rb b/lib/dtas/unix_server.rb index cad3fc4..60ab86c 100644 --- a/lib/dtas/unix_server.rb +++ b/lib/dtas/unix_server.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org> +# Copyright (C) all contributors <dtas-all@nongnu.org> # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt> # frozen_string_literal: true require 'socket' @@ -59,7 +59,7 @@ class DTAS::UNIXServer # :nodoc: def readable_iter # we do not do anything with the block passed to us - case rv = accept_nonblock + case rv = @to_io.accept_nonblock(exception: false) when :wait_readable then return rv else @readers[DTAS::UNIXAccepted.new(rv[0])] = true @@ -114,16 +114,4 @@ class DTAS::UNIXServer # :nodoc: wait_ctl(io, io.readable_iter { |_io, msg| yield(_io, msg) }) end end - - if RUBY_VERSION.to_f >= 2.3 - def accept_nonblock - @to_io.accept_nonblock(exception: false) - end - else - def accept_nonblock - @to_io.accept_nonblock - rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO - :wait_readable - end - end end |