io-endpoint 0.10.1 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/io/endpoint/bound_endpoint.rb +3 -10
- data/lib/io/endpoint/composite_endpoint.rb +1 -1
- data/lib/io/endpoint/connected_endpoint.rb +1 -1
- data/lib/io/endpoint/generic.rb +1 -1
- data/lib/io/endpoint/shared_endpoint.rb +1 -1
- data/lib/io/endpoint/ssl_endpoint.rb +12 -2
- data/lib/io/endpoint/version.rb +2 -2
- data/lib/io/endpoint/wrapper.rb +17 -2
- data/lib/io/endpoint.rb +1 -1
- data/license.md +1 -1
- data.tar.gz.sig +0 -0
- metadata +4 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afbc41c1af461a0f589ca44c76c181ee916aa15cf3942f6c36f28abfe4074a0e
|
4
|
+
data.tar.gz: 4befca414c4f7ab1d3981f3849371f44d9cd2bed59452224decef2c9f49ca476
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86e753b79efe7ad2438a5ac795db34a10887635835eb80767022cf0228370c6c6e2850f51afccf6d82d6f1f80b79290ecbc44807b6237d0d12d1d1f0d4df000d
|
7
|
+
data.tar.gz: 5f5a734cff764e4928d87fdce912278fd49820c4e864a49d092f13df6f4ea7944a28b6a35bae837a6803f381ddbaa9f5b5f6f22e0329af86cc18c9097202b105
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright,
|
4
|
+
# Copyright, 2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require_relative 'generic'
|
7
7
|
require_relative 'composite_endpoint'
|
@@ -12,15 +12,8 @@ module IO::Endpoint
|
|
12
12
|
def self.bound(endpoint, backlog: Socket::SOMAXCONN, close_on_exec: false)
|
13
13
|
sockets = endpoint.bind
|
14
14
|
|
15
|
-
sockets.each do |
|
16
|
-
|
17
|
-
begin
|
18
|
-
server.listen(backlog)
|
19
|
-
rescue Errno::EOPNOTSUPP
|
20
|
-
# Ignore.
|
21
|
-
end
|
22
|
-
|
23
|
-
server.close_on_exec = close_on_exec
|
15
|
+
sockets.each do |socket|
|
16
|
+
socket.close_on_exec = close_on_exec
|
24
17
|
end
|
25
18
|
|
26
19
|
return self.new(endpoint, sockets, **endpoint.options)
|
data/lib/io/endpoint/generic.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2023, by Samuel Williams.
|
4
|
+
# Copyright, 2023-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require_relative 'host_endpoint'
|
7
7
|
require_relative 'generic'
|
@@ -10,6 +10,14 @@ require 'openssl'
|
|
10
10
|
|
11
11
|
module OpenSSL
|
12
12
|
module SSL
|
13
|
+
class SSLSocket
|
14
|
+
unless method_defined?(:start)
|
15
|
+
def start
|
16
|
+
self.accept
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
13
21
|
module SocketForwarder
|
14
22
|
unless method_defined?(:close_on_exec=)
|
15
23
|
def close_on_exec=(value)
|
@@ -113,7 +121,9 @@ module IO::Endpoint
|
|
113
121
|
end
|
114
122
|
|
115
123
|
def make_server(io)
|
116
|
-
::OpenSSL::SSL::SSLServer.new(io, self.context)
|
124
|
+
::OpenSSL::SSL::SSLServer.new(io, self.context).tap do |server|
|
125
|
+
server.start_immediately = false
|
126
|
+
end
|
117
127
|
end
|
118
128
|
|
119
129
|
def make_socket(io)
|
data/lib/io/endpoint/version.rb
CHANGED
data/lib/io/endpoint/wrapper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2023, by Samuel Williams.
|
4
|
+
# Copyright, 2023-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require 'socket'
|
7
7
|
|
@@ -128,7 +128,12 @@ module IO::Endpoint
|
|
128
128
|
socket.bind(local_address.to_sockaddr)
|
129
129
|
|
130
130
|
if backlog
|
131
|
-
|
131
|
+
begin
|
132
|
+
# Generally speaking, bind/listen is a common pattern, but it's not applicable to all socket types. We ignore the error if it's not supported as the alternative is exposing this upstream, which seems less desirable than handling it here. In other words, `bind` in this context means "prepare it to accept connections", whatever that means for the given socket type.
|
133
|
+
socket.listen(backlog)
|
134
|
+
rescue Errno::EOPNOTSUPP
|
135
|
+
# Ignore.
|
136
|
+
end
|
132
137
|
end
|
133
138
|
rescue
|
134
139
|
socket&.close
|
@@ -160,6 +165,16 @@ module IO::Endpoint
|
|
160
165
|
end
|
161
166
|
|
162
167
|
async do
|
168
|
+
# Some sockets, notably SSL sockets, need application level negotiation before they are ready:
|
169
|
+
if socket.respond_to?(:start)
|
170
|
+
begin
|
171
|
+
socket.start
|
172
|
+
rescue
|
173
|
+
socket.close
|
174
|
+
raise
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
163
178
|
yield socket, address
|
164
179
|
end
|
165
180
|
end
|
data/lib/io/endpoint.rb
CHANGED
data/license.md
CHANGED
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.10.
|
4
|
+
version: 0.10.3
|
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-
|
40
|
+
date: 2024-05-10 00:00:00.000000000 Z
|
41
41
|
dependencies: []
|
42
42
|
description:
|
43
43
|
email:
|
@@ -65,6 +65,7 @@ licenses:
|
|
65
65
|
- MIT
|
66
66
|
metadata:
|
67
67
|
documentation_uri: https://socketry.github.io/io-endpoint
|
68
|
+
source_code_uri: https://github.com/socketry/io-endpoint.git
|
68
69
|
post_install_message:
|
69
70
|
rdoc_options: []
|
70
71
|
require_paths:
|
@@ -73,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
74
|
requirements:
|
74
75
|
- - ">="
|
75
76
|
- !ruby/object:Gem::Version
|
76
|
-
version: '3.
|
77
|
+
version: '3.1'
|
77
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
79
|
requirements:
|
79
80
|
- - ">="
|
metadata.gz.sig
CHANGED
Binary file
|