Skip to content

Commit

Permalink
Don't hardcode timeout support - detect at run-time.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Apr 23, 2024
1 parent 3f773d7 commit 770a648
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/io/endpoint/wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@ module IO::Endpoint
class Wrapper
include ::Socket::Constants

if IO.method_defined?(:timeout=)
def set_timeout(io, timeout)
def set_timeout(io, timeout)
if io.respond_to?(:timeout=)
io.timeout = timeout
end
else
def set_timeout(io, timeout)
# warn "IO#timeout= not supported on this platform."
# Unsupported.
end
end

def set_buffered(socket, buffered)
Expand Down

0 comments on commit 770a648

Please sign in to comment.