omq 0.30.1 → 0.30.2
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 +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/omq/transport/tcp.rb +28 -0
- data/lib/omq/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ffbc4732e7488889e31f45a6940f4b1b52ea4c357f2fb1a8b8610686938cd7f1
|
|
4
|
+
data.tar.gz: 5f079c8ed80726142b3c4820b6c4c863f86384f06636c4b93d7eb9a7f8ad870e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c30ba7e7b80e63a12a39fd6579179fa80d41deed838fb10f096adfab44ed3038b9f1d8e2092dd07c02f8d911050ed6abf040a89e67526f5c1f489b998cd971e4
|
|
7
|
+
data.tar.gz: a1081d832c4c15f8e03eba6d6d492ca6a6f8ce8211f2ec539d3a1443345ab7b9af8b6e2a58e668d4dbc2948fb3a0e2378b981843fa7fdbcb3bb011cc7c510473
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.30.2] - 2026-12-02
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- A `tcp://` dial to a free local port can get that same port as its source
|
|
10
|
+
and connect to itself (zeromq/libzmq#4958). The dialer now closes that
|
|
11
|
+
socket and retries as if refused. Before, PAIR, DEALER, ROUTER, CHANNEL
|
|
12
|
+
and PEER sockets completed the handshake with themselves and stayed
|
|
13
|
+
connected to themselves.
|
|
14
|
+
|
|
5
15
|
## [0.30.1] - 2026-11-27
|
|
6
16
|
|
|
7
17
|
### Added
|
data/lib/omq/transport/tcp.rb
CHANGED
|
@@ -147,6 +147,31 @@ module OMQ
|
|
|
147
147
|
sock.setsockopt(::Socket::SOL_SOCKET, ::Socket::SO_RCVBUF, options.rcvbuf)
|
|
148
148
|
end
|
|
149
149
|
end
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
# A dial to a free local port can get that same port as its source
|
|
153
|
+
# and connect to itself (TCP simultaneous open). The handshake would
|
|
154
|
+
# then run against the socket itself. Nothing listens on that port,
|
|
155
|
+
# so this closes +sock+ and raises as refused, and the dialer retries.
|
|
156
|
+
#
|
|
157
|
+
# @param sock [Socket] a dialed socket
|
|
158
|
+
# @return [void]
|
|
159
|
+
# @raise [Errno::ECONNREFUSED] if +sock+ is connected to itself
|
|
160
|
+
#
|
|
161
|
+
def reject_self_connect!(sock)
|
|
162
|
+
local = sock.local_address
|
|
163
|
+
remote = sock.remote_address
|
|
164
|
+
|
|
165
|
+
return unless local.ip_unpack == remote.ip_unpack
|
|
166
|
+
|
|
167
|
+
begin
|
|
168
|
+
sock.close
|
|
169
|
+
rescue SystemCallError
|
|
170
|
+
# A failed close must not hide the refusal the dialer retries on.
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
raise Errno::ECONNREFUSED, "#{remote.inspect_sockaddr} connected to itself"
|
|
174
|
+
end
|
|
150
175
|
end
|
|
151
176
|
|
|
152
177
|
|
|
@@ -179,7 +204,10 @@ module OMQ
|
|
|
179
204
|
host, port = TCP.parse_endpoint(@endpoint)
|
|
180
205
|
host = TCP.normalize_connect_host(host)
|
|
181
206
|
sock = ::Socket.tcp(host, port, connect_timeout: TCP.connect_timeout(@engine.options))
|
|
207
|
+
|
|
208
|
+
TCP.reject_self_connect!(sock)
|
|
182
209
|
TCP.apply_buffer_sizes(sock, @engine.options)
|
|
210
|
+
|
|
183
211
|
@engine.handle_connected(IO::Stream::Buffered.wrap(sock), endpoint: @endpoint)
|
|
184
212
|
end
|
|
185
213
|
|
data/lib/omq/version.rb
CHANGED