Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

Commit c06f706

Browse files
committed
transport: disallow taking connections to nodes that are down
Fixes #222
1 parent f4741ae commit c06f706

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

transport/node.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,16 @@ func (n *Node) Close() {
5454
}
5555

5656
func (n *Node) LeastBusyConn() (*Conn, error) {
57+
if !n.IsUp() {
58+
return nil, fmt.Errorf("node %v is down", n)
59+
}
60+
5761
return n.pool.LeastBusyConn()
5862
}
5963
func (n *Node) Conn(qi QueryInfo) (*Conn, error) {
64+
if !n.IsUp() {
65+
return nil, fmt.Errorf("node %v is down", n)
66+
}
6067
if qi.tokenAware {
6168
return n.pool.Conn(qi.token)
6269
}

0 commit comments

Comments
 (0)