Fix WireGuard shutdown race crashing

Stop peer goroutines before closing the TUN device to prevent
RoutineSequentialReceiver from calling Write on a nil dispatcher.
This commit is contained in:
世界
2026-03-26 16:32:46 +08:00
parent d09182614c
commit e98b4ad449

View File

@@ -229,12 +229,13 @@ func (e *Endpoint) ListenPacket(ctx context.Context, destination M.Socksaddr) (n
}
func (e *Endpoint) Close() error {
if e.device != nil {
e.device.Close()
}
if e.pauseCallback != nil {
e.pause.UnregisterCallback(e.pauseCallback)
}
if e.device != nil {
e.device.Down()
e.device.Close()
}
return nil
}