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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbb4225bd58846cc3ec28c008f11a4da2a3d0073be24ced5d6f4e99873b9cf91
4
- data.tar.gz: 7e11730e874f7c24e4207d661c7e4efceb117b68c31b823b4cabdb5367cbd787
3
+ metadata.gz: ffbc4732e7488889e31f45a6940f4b1b52ea4c357f2fb1a8b8610686938cd7f1
4
+ data.tar.gz: 5f079c8ed80726142b3c4820b6c4c863f86384f06636c4b93d7eb9a7f8ad870e
5
5
  SHA512:
6
- metadata.gz: e27866ec7266e32cee10ed0b70a651d9466018a9900b1754b32697962b845bb6abda645d36c307133739bee41536d99ac1cbf5f7156b02a32122b86b2e484b8a
7
- data.tar.gz: 72970544ae442b3bf35e4ad95800d3d199ec6e72d376ce5fd8f573317e7e10bda51b2154bb68777c50a52e2df8e170756e1ff07e9b1e20cbe84012937b616956
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OMQ
4
- VERSION = "0.30.1"
4
+ VERSION = "0.30.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.1
4
+ version: 0.30.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger