fix(cluster): fall back to origin port when CLUSTER SLOTS reports port 0 (#3828)
In TLS-only clusters started with `--port 0 --tls-port <port>`, CLUSTER SLOTS reports the regular port as 0. newClusterState used to pass that value verbatim into clusterNode.Client.opt.Addr, which the PubSub path dials directly with no MOVED/seed fallback, producing `dial tcp <ip>:0: connection refused`. Add a replaceZeroPort helper symmetric to replaceLoopbackHost: when a slot node's port is "0", substitute the origin endpoint's port — by definition reachable, since it is the port we used to fetch the slot map. NodeAddress is left untouched so maintenance-notification matching continues to see the server-reported value. Adds TestNewClusterState_PortZero covering the bug scenario plus the non-zero passthrough and the loopback+:0 composition. Fixes #3726
N
Nedyalko Dyakov committed
6af9bdc84ba25303f2b9dd9949055ee6224c6d96
Parent: fa5aa8c
Committed by GitHub <noreply@github.com>
on 5/27/2026, 10:51:50 AM