wgengine/magicsock: don't deadlock on shutdown if sending blocks.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson 2020-07-27 20:32:45 +00:00 committed by Dave Anderson
parent 0249236cc0
commit 9265296b33

View File

@ -713,7 +713,11 @@ func newPinger(t *testing.T, logf logger.Logf, src, dst *magicStack) (cleanup fu
// acceptable to test instead of "every ping must
// transit".
pkt := tuntest.Ping(dst.IP(t).IPAddr().IP, src.IP(t).IPAddr().IP)
src.tun.Outbound <- pkt
select {
case src.tun.Outbound <- pkt:
case <-ctx.Done():
return false
}
select {
case <-dst.tun.Inbound:
return true