Skip to content
This repository was archived by the owner on Aug 29, 2024. It is now read-only.

Commit 24f8a97

Browse files
authored
The options need to be passed through to the address endpoints. (#66)
* Newer Ruby can return nil on no data available (instead of empty string).
1 parent e1b0b6c commit 24f8a97

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/async/io/peer.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ def connected?
1818
# If we can wait for the socket to become readable, we know that the socket may still be open.
1919
result = to_io.recv_nonblock(1, MSG_PEEK, exception: false)
2020

21+
# No data was available - newer Ruby can return nil instead of empty string:
22+
return false if result.nil?
23+
2124
# Either there was some data available, or we can wait to see if there is data avaialble.
2225
return !result.empty? || result == :wait_readable
2326

lib/async/io/shared_endpoint.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ def initialize(endpoint, wrappers, **options)
5050

5151
def local_address_endpoint(**options)
5252
endpoints = @wrappers.map do |wrapper|
53-
AddressEndpoint.new(wrapper.to_io.local_address)
53+
# Forward the options to the internal endpoints:
54+
AddressEndpoint.new(wrapper.to_io.local_address, **options)
5455
end
5556

56-
return CompositeEndpoint.new(endpoints, **options)
57+
return CompositeEndpoint.new(endpoints)
5758
end
5859

5960
def remote_address_endpoint(**options)

0 commit comments

Comments
 (0)