async-io 1.8.2 → 1.8.4

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: f7f9fd0c7ac3d55909e9d49bdefffadcb95fa6d22cce97266aa806cdedf8e42d
4
- data.tar.gz: 46436128ec03245e175cc16b50b549b0aaaef7855136ee43fabc9ee9fe5cba0a
3
+ metadata.gz: 28560a2c37617bcd0a356c1cdf4a3d6cae716dcb41cdc687685428bf5d521b6c
4
+ data.tar.gz: 7c0ab76b2c9be55a2b6e7660293439a5748ce80fbdae2f5f25f71bfb9e7156ba
5
5
  SHA512:
6
- metadata.gz: b72f1b1a7de4fc5a3a8f597ab6f82ae1bda12b83ea2873e0f2c271660eddba1cecafe59de190e647936e7e0a272ceedef5541817ed2136927cb327b56324afc5
7
- data.tar.gz: 2bac9e1ede1b00f5b2a614c270f6b2a609acc1108fc25b0a0e48288e9507bf95f9b72d5526bb6df7db028147ab03ba4ba8d1700dbc792fb1391021f1b3641acc
6
+ metadata.gz: a9954fe457d3fc5883bdfd59f5f2b17cab94cee653ba0cea083afa23954ff91e2297d342ed805d2b4c0d5aeae956e4cb9a2e341e60def9d5003e08b7ee09a2b7
7
+ data.tar.gz: 8c59a579a8cd7d2425f298cf98b1caba1acdd6263e79bad028baadc6e517c2a1447e5147e415ba766c1c3446bed938c29f628734fe51528345318d692d75d999
@@ -27,6 +27,7 @@ module Async
27
27
  def initialize
28
28
  pipe = ::IO.pipe
29
29
 
30
+ # We could call wait and signal from different reactors/threads/processes, so we don't create wrappers here, because they are not thread safe by design.
30
31
  @input = pipe.first
31
32
  @output = pipe.last
32
33
  end
@@ -41,12 +42,18 @@ module Async
41
42
  def wait
42
43
  wrapper = Async::IO::Generic.new(@input)
43
44
  wrapper.read(1)
45
+ ensure
46
+ # Remove the wrapper from the reactor.
47
+ wrapper.reactor = nil
44
48
  end
45
49
 
46
50
  # Signal to a given task that it should resume operations.
47
51
  # @return [void]
48
52
  def signal
49
- @output.write(".")
53
+ wrapper = Async::IO::Generic.new(@output)
54
+ wrapper.write(".")
55
+ ensure
56
+ wrapper.reactor = nil
50
57
  end
51
58
  end
52
59
  end
@@ -28,7 +28,7 @@ module Async
28
28
 
29
29
  # Asynchronous TCP socket wrapper.
30
30
  class SSLSocket < Generic
31
- wraps ::OpenSSL::SSL::SSLSocket, :alpn_protocol, :cert, :cipher, :client_ca, :close, :context, :getsockopt, :hostname, :hostname=, :npn_protocol, :peer_cert, :peer_cert_chain, :pending, :post_connection_check, :setsockopt, :session, :session=, :session_reused?, :ssl_version, :state, :sync_close, :sync_close=, :sysclose, :verify_result, :tmp_key
31
+ wraps ::OpenSSL::SSL::SSLSocket, :alpn_protocol, :cert, :cipher, :client_ca, :context, :getsockopt, :hostname, :hostname=, :npn_protocol, :peer_cert, :peer_cert_chain, :pending, :post_connection_check, :setsockopt, :session, :session=, :session_reused?, :ssl_version, :state, :sync_close, :sync_close=, :sysclose, :verify_result, :tmp_key
32
32
 
33
33
  wrap_blocking_method :accept, :accept_nonblock
34
34
  wrap_blocking_method :connect, :connect_nonblock
@@ -73,11 +73,11 @@ module Async
73
73
  end
74
74
 
75
75
  def self.wrap(socket, context)
76
+ io = @wrapped_klass.new(socket.to_io, context)
77
+
76
78
  # We detach the socket from the reactor, otherwise it's possible to add the file descriptor to the selector twice, which is bad.
77
79
  socket.reactor = nil
78
80
 
79
- io = @wrapped_klass.new(socket.to_io, context)
80
-
81
81
  # This ensures that when the internal IO is closed, it also closes the internal socket:
82
82
  io.sync_close = true
83
83
 
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module IO
23
- VERSION = "1.8.2"
23
+ VERSION = "1.8.4"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 1.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-27 00:00:00.000000000 Z
11
+ date: 2018-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async