Skip to content
Snippets Groups Projects
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 tpo/anti-censorship/emma!3
parents 2ed24be8 bcc16008
Branches master
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ import (
"net/url"
"strings"
"time"
"os"
)
// timeout specifies the number of seconds we're willing to wait until we
......@@ -44,10 +45,14 @@ func IsTCPPortReachable(addrTuple string) (r Result) {
r.Target = addrTuple
conn, err := net.DialTimeout("tcp", addrTuple, timeout)
if os.IsTimeout(err) {
conn, err = net.DialTimeout("tcp", addrTuple, timeout)
}
if err != nil {
r.Error = err
return
}
conn.Close()
r.Error = nil
return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment