Browse Source

Fix wireguard events

世界 3 years ago
parent
commit
8e0fe55363
2 changed files with 1 additions and 8 deletions
  1. 1 2
      transport/wireguard/device_stack.go
  2. 0 6
      transport/wireguard/device_system.go

+ 1 - 2
transport/wireguard/device_stack.go

@@ -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() {

+ 0 - 6
transport/wireguard/device_system.go

@@ -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()
 }