Fix wireguard events

This commit is contained in:
世界 committed 2023-01-15 19:48:50 +08:00
1 parent 59e521c1db
commit 8e0fe55363
2 files changed
+1 -8

No files matched your search

+1 -2
View File
@@ -197,10 +197,9 @@ func (w *StackDevice) Events() chan tun.Event {
func (w *StackDevice) Close() error {
select {
case <-w.events:
case <-w.done:
return os.ErrClosed
default:
close(w.events)
}
w.stack.Close()
for _, endpoint := range w.stack.CleanupEndpoints() {
-6
View File
@@ -105,11 +105,5 @@ func (w *SystemDevice) Events() chan wgTun.Event {
}
func (w *SystemDevice) Close() error {
select {
case <-w.events:
return os.ErrClosed
default:
close(w.events)
}
return w.device.Close()
}