Commit d180b228 authored by Philipp Winter's avatar Philipp Winter
Browse files

Merge branch 'issue/6' into 'master'

Try again if TCP connection cannot be established

See merge request !3
parents 2ed24be8 bcc16008
...@@ -9,6 +9,7 @@ import ( ...@@ -9,6 +9,7 @@ import (
"net/url" "net/url"
"strings" "strings"
"time" "time"
"os"
) )
// timeout specifies the number of seconds we're willing to wait until we // timeout specifies the number of seconds we're willing to wait until we
...@@ -44,10 +45,14 @@ func IsTCPPortReachable(addrTuple string) (r Result) { ...@@ -44,10 +45,14 @@ func IsTCPPortReachable(addrTuple string) (r Result) {
r.Target = addrTuple r.Target = addrTuple
conn, err := net.DialTimeout("tcp", addrTuple, timeout) conn, err := net.DialTimeout("tcp", addrTuple, timeout)
if os.IsTimeout(err) {
conn, err = net.DialTimeout("tcp", addrTuple, timeout)
}
if err != nil { if err != nil {
r.Error = err r.Error = err
return return
} }
conn.Close() conn.Close()
r.Error = nil r.Error = nil
return return
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment