From 743dc5c1bf6f83ebd1eaa0d494b5a36e8f142ebb Mon Sep 17 00:00:00 2001 From: zarazaex69 Date: Mon, 25 May 2026 23:33:51 +0300 Subject: [PATCH] fix(client): return after liveness reconnect to avoid deadlock #72 --- internal/client/client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/client/client.go b/internal/client/client.go index ec6dea6..f091a67 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -371,6 +371,12 @@ func (c *Client) handleReconnect(ctx context.Context, cfg Config, cancel context // reconnect callback which then drives a fresh handshake. if reason == "liveness" && c.ln != nil { c.ln.Reconnect("liveness") + // Return immediately — retryHandshake over the dead link would + // loop forever with "open control stream: timeout" while holding + // reconnectMu, blocking the carrier callback that fires once the + // link is actually back up. Let that callback (reason="carrier") + // drive the handshake when the transport is ready. + return } c.retryHandshake(ctx, cfg, cancel, reason)