omq 0.30.0 → 0.30.1

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: c307ca5bbfb86b9b0b8641808900e6a4ebd20d850b71debd7a9bb93a481793f1
4
- data.tar.gz: 56ba1b9a6598847a0fc409fb7689ade3a6acc551b95c893a5e32f0f0900d2783
3
+ metadata.gz: cbb4225bd58846cc3ec28c008f11a4da2a3d0073be24ced5d6f4e99873b9cf91
4
+ data.tar.gz: 7e11730e874f7c24e4207d661c7e4efceb117b68c31b823b4cabdb5367cbd787
5
5
  SHA512:
6
- metadata.gz: 104203f451e68f6e7847a2c8c5b51651ae307b7442224c955f42241ebcbee38cfe1eb5fccfb04ba695c0f17ad9945e806e6e51436607c231b68592f2057c09a3
7
- data.tar.gz: 5e1667fecd724027ec2deb01e9df31bab619a8f03d00bfda9ef579054871d060516c46192be83c5ab1aa517c7b2edd0839883a73f3eff972bda92af6ac66acc7
6
+ metadata.gz: e27866ec7266e32cee10ed0b70a651d9466018a9900b1754b32697962b845bb6abda645d36c307133739bee41536d99ac1cbf5f7156b02a32122b86b2e484b8a
7
+ data.tar.gz: 72970544ae442b3bf35e4ad95800d3d199ec6e72d376ce5fd8f573317e7e10bda51b2154bb68777c50a52e2df8e170756e1ff07e9b1e20cbe84012937b616956
data/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.30.1] - 2026-11-27
6
+
7
+ ### Added
8
+
9
+ - `Engine.endpoint_uri(endpoint)`: the URI `#bind` and `#connect` return,
10
+ built by the transport when it has `.endpoint_uri`. The native backends use
11
+ it for the endpoints they resolve.
12
+
13
+ ### Fixed
14
+
15
+ - `#bind` and `#connect` return a URI that keeps the @ of an abstract IPC
16
+ name. They returned `ipc://name` for `ipc://@name`, because `URI.parse`
17
+ reads the @ as the end of an empty userinfo, and connecting to that dialed
18
+ a relative file path. Abstract names `URI.parse` rejects, such as ones with
19
+ spaces, no longer raise after the bind.
20
+ - `#bind` and `#connect` no longer raise for an IPC file path `URI.parse`
21
+ rejects, such as one with a space. They raised once the socket was already
22
+ bound or dialing.
23
+
5
24
  ## [0.30.0] - 2026-11-26
6
25
 
7
26
  ### Added
data/lib/omq/engine.rb CHANGED
@@ -33,6 +33,21 @@ module OMQ
33
33
  class << self
34
34
  # @return [Hash{String => Module}] registered transports
35
35
  attr_reader :transports
36
+
37
+
38
+ # The URI {#bind} and {#connect} return for +endpoint+. A transport
39
+ # with +.endpoint_uri+ builds it: IPC keeps the @ of abstract names.
40
+ # The native backends use it for the endpoints they resolve.
41
+ #
42
+ # @param endpoint [String]
43
+ # @return [URI::Generic]
44
+ #
45
+ def endpoint_uri(endpoint)
46
+ transport = @transports[endpoint[/\A[^:]+/]]
47
+ return transport.endpoint_uri(endpoint) if transport.respond_to?(:endpoint_uri)
48
+
49
+ URI.parse(endpoint)
50
+ end
36
51
  end
37
52
 
38
53
 
@@ -217,7 +232,7 @@ module OMQ
217
232
  @listeners[listener.endpoint] = listener
218
233
  remember_bind_alias(endpoint, listener.endpoint)
219
234
  emit_monitor_event(:listening, endpoint: listener.endpoint)
220
- URI.parse(listener.endpoint)
235
+ Engine.endpoint_uri(listener.endpoint)
221
236
  rescue => error
222
237
  emit_monitor_event(:bind_failed, endpoint: endpoint, detail: { error: error })
223
238
  raise
@@ -245,7 +260,7 @@ module OMQ
245
260
  schedule_reconnect(endpoint, delay: 0)
246
261
  end
247
262
 
248
- URI.parse(endpoint)
263
+ Engine.endpoint_uri(endpoint)
249
264
  end
250
265
 
251
266
 
@@ -14,6 +14,21 @@ module OMQ
14
14
  Engine.transports["ipc"] = self
15
15
 
16
16
 
17
+ # The URI of an endpoint +URI.parse+ can't keep, with the path as
18
+ # given. +URI.parse+ reads the @ of "ipc://@name" as the end of an
19
+ # empty userinfo, so its #to_s is "ipc://name", a relative file path,
20
+ # and it rejects paths with spaces and similar characters.
21
+ #
22
+ class PathURI < URI::Generic
23
+ # @return [String] e.g. "ipc://@name"
24
+ #
25
+ def to_s
26
+ "ipc://#{path}"
27
+ end
28
+
29
+ end
30
+
31
+
17
32
  class << self
18
33
  # ZMTP connection class used for IPC-accepted/dialed peers.
19
34
  #
@@ -124,9 +139,30 @@ module OMQ
124
139
  end
125
140
 
126
141
 
142
+ # @param endpoint [String] e.g. "ipc:///tmp/my.sock" or "ipc://@abstract"
143
+ # @return [URI::Generic] the endpoint's URI; a {PathURI} for an
144
+ # abstract namespace name or a path +URI.parse+ rejects
145
+ #
146
+ def endpoint_uri(endpoint)
147
+ path = parse_path(endpoint)
148
+ return path_uri(path) if abstract?(path)
149
+
150
+ begin
151
+ URI.parse(endpoint)
152
+ rescue URI::InvalidURIError
153
+ path_uri(path)
154
+ end
155
+ end
156
+
157
+
127
158
  private
128
159
 
129
160
 
161
+ def path_uri(path)
162
+ PathURI.new("ipc", nil, nil, nil, nil, path, nil, nil, nil)
163
+ end
164
+
165
+
130
166
  # Connects to +path+ and hangs up. Raises ECONNREFUSED if nothing
131
167
  # listens there.
132
168
  #
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.0"
4
+ VERSION = "0.30.1"
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.0
4
+ version: 0.30.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger