Repository navigation
Transport: add configurable inbound endpoint port-range - #121
Merged
Merged
Conversation
Member
|
nitpick: It seems weird that a type named |
On Windows, zmq remaps Windows WSAEADDRINUSE (10048) to errno EADDRINUSE (100)
Member
Author
To me it seems natural because I view it as a real, discriminated union type, but I understand your feeling. I like |
Member
Author
|
I renamed |
ocoanet
reviewed
Sep 24, 2026
ocoanet
reviewed
Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
A service bus peer can be configured to listen to a particular endpoint.
We currently support a configuration endpoint syntax where the port can either be a wildcard, eg
tcp://*:*, letting the OS chose an ephemeral port, or a single, fixed port, egtcp://*:14001Motivation
We want to support specifying a port range in a configuration endpoint. This allows for easily discriminating zebus-specific traffic.
Changes
This MR introduces a new
tcp://<host>:[<start>..<end>]syntax to configure the inbound endpoint the peer will listen on.A
[<start>..<end>]range can be configured as a port. The system will then pick the first available port in the range by attempting to bind to any single one.A new
ZmqPortdiscriminated enum type has been introduced to represent such a port, that can take the following values:ZmqPort.Wildcard, represents a*wildcard portZmqPort.Single(port)represents a fixed<port>portZmqPort.Range(start, end)represents a[<start>..<end>]port rangeA
ZmqSocket.TryBindoperation has been introduced to attempt to bind to a given endpoint. When the operation returnsEADDRINUSE, we simply attempt the next port in the range.Two services starting at the same time on the same machine will compete on the same range, but they should all end up succeeding, given a reasonably-sized range.