mirror of
https://github.com/tailscale/tailscale.git
synced 2025-03-26 19:21:01 +00:00
safesocket: respect context timeout when sleeping for 250ms in retry loop
Noticed while working on a dev tool that uses local.Client. Updates #cleanup Change-Id: I981efff74a5cac5f515755913668bd0508a4aa14 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
c261fb198f
commit
e1078686b3
@ -61,7 +61,11 @@ func ConnectContext(ctx context.Context, path string) (net.Conn, error) {
|
||||
if ctx.Err() != nil {
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
time.Sleep(250 * time.Millisecond)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
case <-time.After(250 * time.Millisecond):
|
||||
}
|
||||
continue
|
||||
}
|
||||
return c, err
|
||||
|
Loading…
x
Reference in New Issue
Block a user