io-endpoint 0.8.0 → 0.9.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: 101337315cb2358a521c656373439b2a65807e61705907bfed1a0773223ea0b5
4
- data.tar.gz: 98410d7c0e2ab39ec1fd4526c4716574a3316e4ca5660899f84ae36b699e8e3b
3
+ metadata.gz: a8c719f57ec802f2b04eed41ba8ae7b1a1d50ce90b2d4f0c7188c4b8f62f7306
4
+ data.tar.gz: dd9bdffdb227f14e4de51d7da5d345ff230b8d05c1da91c41d6f928ce2844a01
5
5
  SHA512:
6
- metadata.gz: b1124ce85f59b84610293c4df08c40bccade1071405053031757dd9971ae100e359206a78a953a1f9afee0aca305a33a1bb42abd9eb91a69dae2a0bfc13373f5
7
- data.tar.gz: bfa3f25fc5ec808a19173683d7c2356b97b4b54220011cf26b8a92758de3fc0f3ee4b95f1fa751c222ab71f186d1ae50f2d92ff07787f0993e398ee0bd10fba2
6
+ metadata.gz: b8da3c12efc9df9557fdd23d08364a34cde7d89777e078d695fbea2470e3a3a4a30b58d33e0cebaffea0680fd609cdf13a66239f390abe366ae18139eb3860c3
7
+ data.tar.gz: 0cf5dc1fa569e2f010bdcfdd5351e21ccb0a92055d0af361b7dafae7d0431923556c4673fc6975989211e8cdaf7a449c1f277588d5ae68e78409ac7d5b6bbc30
checksums.yaml.gz.sig CHANGED
Binary file
@@ -112,17 +112,28 @@ module IO::Endpoint
112
112
  @context ||= build_context
113
113
  end
114
114
 
115
+ def make_server(io)
116
+ ::OpenSSL::SSL::SSLServer.new(io, self.context)
117
+ end
118
+
119
+ def make_socket(io)
120
+ ::OpenSSL::SSL::SSLSocket.new(io, self.context).tap do |socket|
121
+ # We consider the underlying IO is owned by the SSL socket:
122
+ socket.sync_close = true
123
+ end
124
+ end
125
+
115
126
  # Connect to the underlying endpoint and establish a SSL connection.
116
127
  # @yield [Socket] the socket which is being connected
117
128
  # @return [Socket] the connected socket
118
129
  def bind(*arguments, **options, &block)
119
130
  if block_given?
120
131
  @endpoint.bind(*arguments, **options) do |server|
121
- yield ::OpenSSL::SSL::SSLServer.new(server, self.context)
132
+ yield self.make_server(server)
122
133
  end
123
134
  else
124
135
  @endpoint.bind(*arguments, **options).map do |server|
125
- ::OpenSSL::SSL::SSLServer.new(server, self.context)
136
+ self.make_server(server)
126
137
  end
127
138
  end
128
139
  end
@@ -131,7 +142,7 @@ module IO::Endpoint
131
142
  # @yield [Socket] the socket which is being connected
132
143
  # @return [Socket] the connected socket
133
144
  def connect(&block)
134
- socket = ::OpenSSL::SSL::SSLSocket.new(@endpoint.connect, self.context)
145
+ socket = self.make_socket(@endpoint.connect)
135
146
 
136
147
  if hostname = self.hostname
137
148
  socket.hostname = hostname
@@ -5,6 +5,6 @@
5
5
 
6
6
  class IO
7
7
  module Endpoint
8
- VERSION = "0.8.0"
8
+ VERSION = "0.9.0"
9
9
  end
10
10
  end
data/lib/io/endpoint.rb CHANGED
@@ -7,8 +7,6 @@ require_relative "endpoint/version"
7
7
  require_relative "endpoint/generic"
8
8
  require_relative "endpoint/shared_endpoint"
9
9
 
10
- require_relative 'readable'
11
-
12
10
  module IO::Endpoint
13
11
  def self.file_descriptor_limit
14
12
  Process.getrlimit(Process::RLIMIT_NOFILE).first
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: io-endpoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -37,7 +37,7 @@ cert_chain:
37
37
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
38
38
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
39
39
  -----END CERTIFICATE-----
40
- date: 2024-04-22 00:00:00.000000000 Z
40
+ date: 2024-04-23 00:00:00.000000000 Z
41
41
  dependencies: []
42
42
  description:
43
43
  email:
metadata.gz.sig CHANGED
Binary file