Skip to content

Commit

Permalink
Fix: do not segfault on first connection timeout :(
Browse files Browse the repository at this point in the history
  • Loading branch information
Chupaka committed Feb 9, 2023
1 parent 7c0cc78 commit 9d20722
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,10 @@ func getMasterAddr(port string, timeout int) *net.TCPAddr {
for _, node := range config.Nodes {
d := net.Dialer{Timeout: time.Duration(timeout) * time.Second}
conn, err := d.Dial("tcp", node+":"+port)
if (err != nil) && (timeout != 1) {
log.Printf("Can't connect to %s with timeout %ds: %s\n", node, timeout, err)
if err != nil {
if timeout != 1 {
log.Printf("Can't connect to %s with timeout %ds: %s\n", node, timeout, err)
}
continue
}

Expand Down

0 comments on commit 9d20722

Please sign in to comment.