Skip to content

Retry outbound socket connections after a delay - #122

Open
ocoanet wants to merge 1 commit into
masterfrom
outbound-socket-reconnect
Open

ocoanet wants to merge 1 commit into
masterfrom
outbound-socket-reconnect

Conversation

@ocoanet

@ocoanet ocoanet commented Nov 23, 2026

Copy link
Copy Markdown
Member

If ZmqSocket.Connect fails on an outbound socket, the socket remains disconnected and messages to the target peer are dropped. Although ZmqSocketOptions.ClosedStateDurationAfterConnectFailure defines a retry delay, the connection is never retried after that delay expires.

This issue is rare because ZmqSocket.Connect usually succeeds. It can fail when the system cannot allocate additional sockets or handles.

This PR retries the connection when a message is sent after the configured delay has expired.

It also adds ZmqSocketOptions.OutboundEndpointValidator, which can be used to reject endpoints before connecting, allowing tests to simulate connection failures.

@ocoanet
ocoanet force-pushed the outbound-socket-reconnect branch from d9cc0ab to 685a123 Compare November 23, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant