async-io 1.38.1 → 1.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9c42280cad79e5f9cdd165ee3f632719d4ebb8a3da0d369308fe87e673670eb
4
- data.tar.gz: 07b3ef3f0c387feb66bcef242b70840827b5c59df0709aac4833f90bc7e3b8a3
3
+ metadata.gz: 35ab781a6326f6ba8743f953608e78b6bfc95de508667cc6a07999e2f0564607
4
+ data.tar.gz: b77dcb0fc4ede58d173be22808e040fb17f79228263cf7b8be7cb758e54d2638
5
5
  SHA512:
6
- metadata.gz: 006c0154b39914d3cf0102c87a258505e497632792f7b42fc82e6177d3398e7b4f41482e351a8e3cf59d3561ff630f78714571e8d3c55ab6d9e4d188c7c24956
7
- data.tar.gz: dbd2affa629c50623f3de7ca8a913507c79e40ae4cdad729995ae1a169ad756f4f665a77c2604f3643976aafa2fa91647cfe5fb4c905868c481f6ba30ae4580e
6
+ metadata.gz: fff9ad34a8396466dadfb4d8a96b9d8aeb1601219b0586aa248ef7907894e4f2f795453f48e8337f07675f8d7092fdb460d4692d8082439b2fa6df6d7023ca4c
7
+ data.tar.gz: 69dd0d6fd8d17c4768ff75d1f5fd29939e454b96735b98c94fef47f5deeb515d6193517f56a8c7c4457238e18630fa0d8db423e7e76dc4562be6a24349891a1d
checksums.yaml.gz.sig CHANGED
Binary file
@@ -78,23 +78,6 @@ module Async
78
78
  end
79
79
  end
80
80
 
81
- # Map all endpoints by invoking `#bind`.
82
- # @yield the bound wrapper.
83
- def bound
84
- wrappers = []
85
-
86
- self.each do |endpoint|
87
- wrapper = endpoint.bind
88
- wrappers << wrapper
89
-
90
- yield wrapper
91
- end
92
-
93
- return wrappers
94
- ensure
95
- wrappers.each(&:close) if $!
96
- end
97
-
98
81
  # Create an Endpoint instance by URI scheme. The host and port of the URI will be passed to the Endpoint factory method, along with any options.
99
82
  #
100
83
  # @param string [String] URI as string. Scheme will decide implementation used.
@@ -12,8 +12,10 @@ module Async
12
12
  # Pre-connect and pre-bind sockets so that it can be used between processes.
13
13
  class SharedEndpoint < Endpoint
14
14
  # Create a new `SharedEndpoint` by binding to the given endpoint.
15
- def self.bound(endpoint, backlog: Socket::SOMAXCONN, close_on_exec: false)
16
- wrappers = endpoint.bound do |server|
15
+ def self.bound(endpoint, backlog: Socket::SOMAXCONN, close_on_exec: false, **options)
16
+ sockets = Array(endpoint.bind(**options))
17
+
18
+ wrappers = sockets.each do |server|
17
19
  # This is somewhat optional. We want to have a generic interface as much as possible so that users of this interface can just call it without knowing a lot of internal details. Therefore, we ignore errors here if it's because the underlying socket does not support the operation.
18
20
  begin
19
21
  server.listen(backlog)
@@ -117,5 +119,15 @@ module Async
117
119
  "\#<#{self.class} #{@wrappers.size} descriptors for #{@endpoint}>"
118
120
  end
119
121
  end
122
+
123
+ class Endpoint
124
+ def bound(**options)
125
+ SharedEndpoint.bound(self, **options)
126
+ end
127
+
128
+ def connected(**options)
129
+ SharedEndpoint.connected(self, **options)
130
+ end
131
+ end
120
132
  end
121
133
  end
@@ -65,7 +65,9 @@ module Async
65
65
  yield SSLServer.new(server, context)
66
66
  end
67
67
  else
68
- return SSLServer.new(@endpoint.bind, context)
68
+ @endpoint.bind.map do |server|
69
+ SSLServer.new(server, context)
70
+ end
69
71
  end
70
72
  end
71
73
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module IO
8
- VERSION = "1.38.1"
8
+ VERSION = "1.39.0"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.38.1
4
+ version: 1.39.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -46,7 +46,7 @@ cert_chain:
46
46
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
47
47
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
48
48
  -----END CERTIFICATE-----
49
- date: 2023-12-29 00:00:00.000000000 Z
49
+ date: 2024-01-22 00:00:00.000000000 Z
50
50
  dependencies:
51
51
  - !ruby/object:Gem::Dependency
52
52
  name: async
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
203
  - !ruby/object:Gem::Version
204
204
  version: '0'
205
205
  requirements: []
206
- rubygems_version: 3.4.10
206
+ rubygems_version: 3.4.22
207
207
  signing_key:
208
208
  specification_version: 4
209
209
  summary: Provides support for asynchonous TCP, UDP, UNIX and SSL sockets.
metadata.gz.sig CHANGED
Binary file