Skip to content
This repository was archived by the owner on Aug 29, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/async/io/peer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def connected?
# If we can wait for the socket to become readable, we know that the socket may still be open.
result = to_io.recv_nonblock(1, MSG_PEEK, exception: false)

# No data was available - newer Ruby can return nil instead of empty string:
return false if result.nil?

# Either there was some data available, or we can wait to see if there is data avaialble.
return !result.empty? || result == :wait_readable

Expand Down
5 changes: 3 additions & 2 deletions lib/async/io/shared_endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ def initialize(endpoint, wrappers, **options)

def local_address_endpoint(**options)
endpoints = @wrappers.map do |wrapper|
AddressEndpoint.new(wrapper.to_io.local_address)
# Forward the options to the internal endpoints:
AddressEndpoint.new(wrapper.to_io.local_address, **options)
end

return CompositeEndpoint.new(endpoints, **options)
return CompositeEndpoint.new(endpoints)
end

def remote_address_endpoint(**options)
Expand Down