diff options
| author | David Crawshaw <crawshaw@tailscale.com> | 2020-03-11 10:40:46 -0400 |
|---|---|---|
| committer | David Crawshaw <crawshaw@tailscale.com> | 2020-03-11 12:13:46 -0400 |
| commit | 1ad8f679ea598c051ed0a89628eeb6bf583709cd (patch) | |
| tree | 4162048e889af5ef5f74de7fc1cc1c1934a66761 | |
| parent | af58cfc476cd6b9268077b4f48696358f023f685 (diff) | |
| download | tailscale-crawshaw/derpdial2.tar.xz tailscale-crawshaw/derpdial2.zip | |
wgengine/magicsock: remove TODOcrawshaw/derpdial2
The TODO above derphttp.NewClient suggests it does network I/O,
but the derphttp client connects lazily and so creating one is
very cheap.
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
| -rw-r--r-- | wgengine/magicsock/magicsock.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index ce3903905..b67f0bd31 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -706,7 +706,8 @@ func (c *Conn) derpWriteChanOfAddr(addr *net.UDPAddr) chan<- derpWriteRequest { return nil } - // TODO(bradfitz): don't hold derpMu here. It's slow. Release first and use singleflight to dial+re-lock to add. + // Note that derphttp.NewClient does not dial the server + // so it is safe to do under the derpMu lock. dc, err := derphttp.NewClient(c.privateKey, "https://"+derpSrv.HostHTTPS+"/derp", c.logf) if err != nil { c.logf("derphttp.NewClient: port %d, host %q invalid? err: %v", addr.Port, derpSrv.HostHTTPS, err) |
