mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 19:08:58 +00:00
Also the call site where it shouldn't anyway be looking at the conn when the err is non-nil.
This commit is contained in:
parent
cb624dbf5d
commit
4e4b9a872a
@ -76,10 +76,10 @@ func dialContextWithFallback(ctx context.Context, fallback proxy.ContextDialer,
|
|||||||
if noFallback {
|
if noFallback {
|
||||||
conn, err := dialer.DialContext(ctx, network, addr)
|
conn, err := dialer.DialContext(ctx, network, addr)
|
||||||
l.Debugf("Dialing no fallback result %s %s: %v %v", network, addr, conn, err)
|
l.Debugf("Dialing no fallback result %s %s: %v %v", network, addr, conn, err)
|
||||||
conn = dialerConn{
|
if err != nil {
|
||||||
conn, newDialerAddr(network, addr),
|
return nil, err
|
||||||
}
|
}
|
||||||
return conn, err
|
return dialerConn{conn, newDialerAddr(network, addr)}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
@ -91,8 +91,8 @@ func dialContextWithFallback(ctx context.Context, fallback proxy.ContextDialer,
|
|||||||
go func() {
|
go func() {
|
||||||
proxyConn, proxyErr = dialer.DialContext(ctx, network, addr)
|
proxyConn, proxyErr = dialer.DialContext(ctx, network, addr)
|
||||||
l.Debugf("Dialing proxy result %s %s: %v %v", network, addr, proxyConn, proxyErr)
|
l.Debugf("Dialing proxy result %s %s: %v %v", network, addr, proxyConn, proxyErr)
|
||||||
proxyConn = dialerConn{
|
if proxyErr == nil {
|
||||||
proxyConn, newDialerAddr(network, addr),
|
proxyConn = dialerConn{proxyConn, newDialerAddr(network, addr)}
|
||||||
}
|
}
|
||||||
close(proxyDone)
|
close(proxyDone)
|
||||||
}()
|
}()
|
||||||
|
@ -22,7 +22,7 @@ func TCPPing(ctx context.Context, address string) (time.Duration, error) {
|
|||||||
ctx, cancel := context.WithTimeout(ctx, time.Second)
|
ctx, cancel := context.WithTimeout(ctx, time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
conn, err := dialer.DialContext(ctx, "tcp", address)
|
conn, err := dialer.DialContext(ctx, "tcp", address)
|
||||||
if conn != nil {
|
if err == nil {
|
||||||
conn.Close()
|
conn.Close()
|
||||||
}
|
}
|
||||||
return time.Since(start), err
|
return time.Since(start), err
|
||||||
|
Loading…
Reference in New Issue
Block a user