async-io 1.38.1 → 1.41.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9c42280cad79e5f9cdd165ee3f632719d4ebb8a3da0d369308fe87e673670eb
4
- data.tar.gz: 07b3ef3f0c387feb66bcef242b70840827b5c59df0709aac4833f90bc7e3b8a3
3
+ metadata.gz: 13accb9aa9b86e13df17282c3eda74b75a87ff12a1754b61f00394c6278025e5
4
+ data.tar.gz: 192b1c8b7035bb72dff4316e77c454458a674b1a848a08f09dcfff7c6f96af04
5
5
  SHA512:
6
- metadata.gz: 006c0154b39914d3cf0102c87a258505e497632792f7b42fc82e6177d3398e7b4f41482e351a8e3cf59d3561ff630f78714571e8d3c55ab6d9e4d188c7c24956
7
- data.tar.gz: dbd2affa629c50623f3de7ca8a913507c79e40ae4cdad729995ae1a169ad756f4f665a77c2604f3643976aafa2fa91647cfe5fb4c905868c481f6ba30ae4580e
6
+ metadata.gz: 8ef16c40109d9a13bd979caf8eabe511e1b5fb1915cb20377698e02fd6eacc26325be812e5d9df0f709f9b99a50105c530daa18d730f635deca7f07e3f34cd4a
7
+ data.tar.gz: 57d1ed64f94e18c7c336ce72184d5735e7f74f1fd2cf51aa6205fe486dd6aeac764bd545dbc73f01e3c379f5d74632317ed27fc3db0db4e17a52d94bf715dd73
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.41.0"
9
9
  end
10
10
  end
data/lib/async/io.rb CHANGED
@@ -11,6 +11,7 @@ require_relative "io/version"
11
11
 
12
12
  require_relative "io/endpoint"
13
13
  require_relative "io/endpoint/each"
14
+ require_relative "io/shared_endpoint"
14
15
 
15
16
  module Async
16
17
  module IO
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.41.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