omq 0.17.4 → 0.17.6

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: 6c00d04d926fae9c6feb6526a611ff3f2ebc05812c7387ac0f97206c7a0b15bb
4
- data.tar.gz: 6af6b6ce8996c5f5082aac1f3b44339de359876aa17e01cfe2255b4681a053c6
3
+ metadata.gz: b990bcb03502bd0cc09d92cf0c402dfeca1602faec96ecfce85500f0c1d2aa7b
4
+ data.tar.gz: 129e85fa71560045d6bba7d1fbb3c21c8c12cba112c840e70802fc81606fe23b
5
5
  SHA512:
6
- metadata.gz: 0db98892b62b35fc06e7a9fca89868ff1dec3bddc5ab4b5d4039bf29290702ed6db122c609c2311789159520638f9339744fdf20df39086b350f183c502075a9
7
- data.tar.gz: 85eae7b6058ead5d02cdddd41bec7dced3882b44267f1a566bc5964eab11eca6d56de23898f9912f985f86685f32690b2edfc555eee0784ac8f74da470c2cd71
6
+ metadata.gz: e729dc6c1ff1db46cba68feeb0bd017cf09049a1a65b7e908b54cbcf398851ecb04c4ee5dae8ee35244061638e85c1314dcee9cfa458026c30c7fe27543689ee
7
+ data.tar.gz: ea9d7aa704da50ff2cb00ecd254888dfb613e27d65a3c2e72bf5f6330f458060417da18f7c84f56902b3d53ea77c89d98a71837d33dafe2cbc0b6b03fb2d9cc5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.6 — 2026-04-10
4
+
5
+ ### Fixed
6
+
7
+ - **Silence Async warning on handshake timeout.** `spawn_connection`
8
+ now rescues `Async::TimeoutError` so a timed-out ZMTP handshake
9
+ doesn't emit an "unhandled exception" warning from the Async task.
10
+
11
+ ## 0.17.5 — 2026-04-10
12
+
13
+ ### Fixed
14
+
15
+ - **Handshake timeout.** `ConnectionLifecycle#handshake!` now wraps
16
+ the ZMTP greeting/handshake exchange with a timeout (reconnect
17
+ interval, floor 0.5s). Prevents a hang when a non-ZMQ service
18
+ accepts the TCP connection but never sends a ZMTP greeting (e.g.
19
+ macOS AirPlay Receiver on port 5000). On timeout the connection
20
+ tears down with `reconnect: true`, so the retry loop picks up.
21
+
3
22
  ## 0.17.4 — 2026-04-10
4
23
 
5
24
  ### Fixed
@@ -82,11 +82,11 @@ module OMQ
82
82
  mechanism: @engine.options.mechanism&.dup,
83
83
  max_message_size: @engine.options.max_message_size,
84
84
  )
85
- conn.handshake!
85
+ Async::Task.current.with_timeout(handshake_timeout) { conn.handshake! }
86
86
  Heartbeat.start(@barrier, conn, @engine.options, @engine.tasks)
87
87
  ready!(conn)
88
88
  @conn
89
- rescue Protocol::ZMTP::Error, *CONNECTION_LOST => error
89
+ rescue Protocol::ZMTP::Error, *CONNECTION_LOST, Async::TimeoutError => error
90
90
  @engine.emit_monitor_event(:handshake_failed, endpoint: @endpoint, detail: { error: error })
91
91
  conn&.close
92
92
  # Full tear-down with reconnect: without this, spawn_connection's
@@ -189,6 +189,18 @@ module OMQ
189
189
  end
190
190
 
191
191
 
192
+ # Handshake timeout: same logic as TCP.connect_timeout — derived
193
+ # from reconnect_interval (floor 0.5s). Prevents a hang when the
194
+ # peer accepts the TCP connection but never sends a ZMTP greeting
195
+ # (e.g. a non-ZMQ service on the same port).
196
+ #
197
+ def handshake_timeout
198
+ ri = @engine.options.reconnect_interval
199
+ ri = ri.end if ri.is_a?(Range)
200
+ [ri, 0.5].max
201
+ end
202
+
203
+
192
204
  def transition!(new_state)
193
205
  allowed = TRANSITIONS[@state]
194
206
  unless allowed&.include?(new_state)
data/lib/omq/engine.rb CHANGED
@@ -479,8 +479,8 @@ module OMQ
479
479
  # socket barrier stopped — cascade teardown
480
480
  rescue Async::Queue::ClosedError
481
481
  # connection dropped during drain — message re-staged
482
- rescue Protocol::ZMTP::Error, *CONNECTION_LOST
483
- # handshake failed or connection lost subtree cleaned up
482
+ rescue Protocol::ZMTP::Error, *CONNECTION_LOST, Async::TimeoutError
483
+ # handshake failed, connection lost, or handshake timed out
484
484
  ensure
485
485
  lifecycle&.close!
486
486
  end
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.17.4"
4
+ VERSION = "0.17.6"
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.17.4
4
+ version: 0.17.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger