async-io 1.15.3 → 1.15.4

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: 6b3e33143cf2ccbc3f24426154313aad72c993a8774a2b6174f5c966bcc19ac4
4
- data.tar.gz: c21d6a717368f76a9fd6f03c372b9475ffe8ea0581090ad3b524c0342f486411
3
+ metadata.gz: aaa9086327397becd3411c9461ebee4b97c6cc9761df7fa77f244a3097c1089c
4
+ data.tar.gz: d4f414eed9c90a1b42bb6cfffe366c54c7c27dafe72b4109d3bcb03e8b49b90b
5
5
  SHA512:
6
- metadata.gz: 889b395f78a2501ea94ddc1c987b4bb3e7d6bf5220ae0e32a8deb146aede4d49b02a38bcde0a0026a64f6bde7dadf3ef2c34a85c2621126ed1eb840a793b7868
7
- data.tar.gz: a73a7d2121f76c413746cd731db704cfcba26745c2493dbd072d973fd3325bc61a1d2a5ffed75f97d1db758a2da6db94933c47072f798dda85f8ba46f94897ee
6
+ metadata.gz: 8a1b63883e34dbbbdc8bd257a8a3180012c060a1353b11aa1a4495109778e0a2c18bf93811af1ae8d56b767f7823f6b380eb306ce33185cd2c54150b03c802d5
7
+ data.tar.gz: 94c1ea7ecc884f4940c760e03d4736da7eea7340a6b68516ec426a95b086ce9fce29503a883a43f0b1ef75a571b2f5f18b2764b6e5deb27fa0d214457ca296de
@@ -28,6 +28,12 @@ module Async
28
28
  super(**options)
29
29
 
30
30
  @endpoint = endpoint
31
+
32
+ if ssl_context = options[:ssl_context]
33
+ @context = build_context(ssl_context)
34
+ else
35
+ @context = nil
36
+ end
31
37
  end
32
38
 
33
39
  def to_s
@@ -45,23 +51,21 @@ module Async
45
51
  @options[:ssl_params]
46
52
  end
47
53
 
48
- def context
49
- if context = @options[:ssl_context]
50
- if params = self.params
51
- context = context.dup
52
- context.set_params(params)
53
- end
54
- else
55
- context = ::OpenSSL::SSL::SSLContext.new
56
-
57
- if params = self.params
58
- context.set_params(params)
59
- end
54
+ def build_context(context = ::OpenSSL::SSL::SSLContext.new)
55
+ if params = self.params
56
+ context.set_params(params)
60
57
  end
61
58
 
59
+ context.setup
60
+ context.freeze
61
+
62
62
  return context
63
63
  end
64
64
 
65
+ def context
66
+ @context ||= build_context
67
+ end
68
+
65
69
  # Connect to the underlying endpoint and establish a SSL connection.
66
70
  # @yield [Socket] the socket which is being connected
67
71
  # @return [Socket] the connected socket
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module IO
23
- VERSION = "1.15.3"
23
+ VERSION = "1.15.4"
24
24
  end
25
25
  end
@@ -32,8 +32,8 @@ RSpec.shared_examples_for Async::IO::SharedEndpoint do |container_class|
32
32
  include_context Async::RSpec::SSL::ValidCertificate
33
33
 
34
34
  let(:endpoint) {Async::IO::Endpoint.tcp("127.0.0.1", 6781, reuse_port: true)}
35
- let(:server_endpoint) {Async::IO::SecureEndpoint.new(endpoint, ssl_context: server_context)}
36
- let(:client_endpoint) {Async::IO::SecureEndpoint.new(endpoint, ssl_context: client_context)}
35
+ let(:server_endpoint) {Async::IO::SSLEndpoint.new(endpoint, ssl_context: server_context)}
36
+ let(:client_endpoint) {Async::IO::SSLEndpoint.new(endpoint, ssl_context: client_context)}
37
37
 
38
38
  let!(:bound_endpoint) do
39
39
  Async::Reactor.run do
@@ -42,7 +42,7 @@ RSpec.shared_examples_for Async::IO::SharedEndpoint do |container_class|
42
42
  end
43
43
 
44
44
  it "can use bound endpoint in container" do
45
- container = container_class.new(concurrency: 8) do
45
+ container = container_class.new(concurrency: 1) do
46
46
  bound_endpoint.accept do |peer|
47
47
  peer.write "Hello World"
48
48
  peer.close
@@ -64,6 +64,6 @@ RSpec.describe Async::Container::Forked do
64
64
  it_behaves_like Async::IO::SharedEndpoint, described_class
65
65
  end
66
66
 
67
- RSpec.describe Async::Container::Threaded do
67
+ RSpec.describe Async::Container::Threaded, if: RUBY_PLATFORM !~ /darwin/ do
68
68
  it_behaves_like Async::IO::SharedEndpoint, described_class
69
69
  end
@@ -31,8 +31,8 @@ RSpec.describe Async::IO::SSLServer do
31
31
  include_context Async::RSpec::SSL::ValidCertificate
32
32
 
33
33
  let(:endpoint) {Async::IO::Endpoint.tcp("127.0.0.1", 6780, reuse_port: true)}
34
- let(:server_endpoint) {Async::IO::SecureEndpoint.new(endpoint, ssl_context: server_context)}
35
- let(:client_endpoint) {Async::IO::SecureEndpoint.new(endpoint, ssl_context: client_context)}
34
+ let(:server_endpoint) {Async::IO::SSLEndpoint.new(endpoint, ssl_context: server_context)}
35
+ let(:client_endpoint) {Async::IO::SSLEndpoint.new(endpoint, ssl_context: client_context)}
36
36
 
37
37
  let(:data) {"What one programmer can do in one month, two programmers can do in two months."}
38
38
 
@@ -67,9 +67,9 @@ RSpec.describe Async::IO::SSLServer do
67
67
  include_context Async::RSpec::SSL::HostCertificates
68
68
 
69
69
  let(:endpoint) {Async::IO::Endpoint.tcp("127.0.0.1", 6782, reuse_port: true)}
70
- let(:server_endpoint) {Async::IO::SecureEndpoint.new(endpoint, ssl_context: server_context)}
71
- let(:valid_client_endpoint) {Async::IO::SecureEndpoint.new(endpoint, hostname: 'example.com', ssl_context: client_context)}
72
- let(:invalid_client_endpoint) {Async::IO::SecureEndpoint.new(endpoint, hostname: 'fleeb.com', ssl_context: client_context)}
70
+ let(:server_endpoint) {Async::IO::SSLEndpoint.new(endpoint, ssl_context: server_context)}
71
+ let(:valid_client_endpoint) {Async::IO::SSLEndpoint.new(endpoint, hostname: 'example.com', ssl_context: client_context)}
72
+ let(:invalid_client_endpoint) {Async::IO::SSLEndpoint.new(endpoint, hostname: 'fleeb.com', ssl_context: client_context)}
73
73
 
74
74
  let(:data) {"What one programmer can do in one month, two programmers can do in two months."}
75
75
 
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.15.3
4
+ version: 1.15.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams