mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
* lib/relays: Fix incorrect timeout, bring back logging (ref #6289) * Fix format strings
This commit is contained in:
parent
b9879e2013
commit
17b441c993
@ -65,10 +65,14 @@ func dialContextWithFallback(ctx context.Context, fallback proxy.ContextDialer,
|
||||
return nil, errUnexpectedInterfaceType
|
||||
}
|
||||
if dialer == proxy.Direct {
|
||||
return fallback.DialContext(ctx, network, addr)
|
||||
conn, err := fallback.DialContext(ctx, network, addr)
|
||||
l.Debugf("Dialing direct result %s %s: %v %v", network, addr, conn, err)
|
||||
return conn, err
|
||||
}
|
||||
if noFallback {
|
||||
return 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)
|
||||
return conn, err
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
@ -79,10 +83,12 @@ func dialContextWithFallback(ctx context.Context, fallback proxy.ContextDialer,
|
||||
fallbackDone := make(chan struct{})
|
||||
go func() {
|
||||
proxyConn, proxyErr = dialer.DialContext(ctx, network, addr)
|
||||
l.Debugf("Dialing proxy result %s %s: %v %v", network, addr, proxyConn, proxyErr)
|
||||
close(proxyDone)
|
||||
}()
|
||||
go func() {
|
||||
fallbackConn, fallbackErr = fallback.DialContext(ctx, network, addr)
|
||||
l.Debugf("Dialing fallback result %s %s: %v %v", network, addr, fallbackConn, fallbackErr)
|
||||
close(fallbackDone)
|
||||
}()
|
||||
<-proxyDone
|
||||
|
@ -152,7 +152,7 @@ func (c *staticClient) connect(ctx context.Context) error {
|
||||
}
|
||||
|
||||
t0 := time.Now()
|
||||
timeoutCtx, cancel := context.WithTimeout(ctx, time.Second)
|
||||
timeoutCtx, cancel := context.WithTimeout(ctx, c.connectTimeout)
|
||||
defer cancel()
|
||||
tcpConn, err := dialer.DialContext(timeoutCtx, "tcp", c.uri.Host)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user