mirror of
https://github.com/tailscale/tailscale.git
synced 2026-03-26 18:21:15 -04:00
tsnet: fix slow test shutdown leading to flakes
TestDial in particular sometimes gets stuck in CI for minutes, letting chantun drop packets during shutdown avoids blocking shutdown. Updates #18423 Signed-off-by: James Tucker <jftucker@gmail.com>
This commit is contained in:
@@ -1881,8 +1881,8 @@ type chanTUN struct {
|
||||
|
||||
func newChanTUN() *chanTUN {
|
||||
t := &chanTUN{
|
||||
Inbound: make(chan []byte, 10),
|
||||
Outbound: make(chan []byte, 10),
|
||||
Inbound: make(chan []byte, 1024),
|
||||
Outbound: make(chan []byte, 1024),
|
||||
closed: make(chan struct{}),
|
||||
events: make(chan tun.Event, 1),
|
||||
}
|
||||
@@ -1922,6 +1922,10 @@ func (t *chanTUN) Write(bufs [][]byte, offset int) (int, error) {
|
||||
case <-t.closed:
|
||||
return 0, errors.New("closed")
|
||||
case t.Inbound <- slices.Clone(pkt):
|
||||
default:
|
||||
// Drop the packet if the channel is full, like a real
|
||||
// TUN under congestion. This avoids blocking the
|
||||
// WireGuard send path when no goroutine is draining.
|
||||
}
|
||||
}
|
||||
return len(bufs), nil
|
||||
|
||||
Reference in New Issue
Block a user