[PATCH] tun: darwin: fix panic: close of closed channel

liuhaichao at bytedance.com liuhaichao at bytedance.com
Sun Aug 25 11:25:31 CEST 2019


From: liuhaichao <liuhaichao at bytedance.com>

Change-Id: Idd77fef05316f817e03a0f905ac5e6d53a6865f7
---
 tun/tun_darwin.go | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tun/tun_darwin.go b/tun/tun_darwin.go
index 0815495..07abc6b 100644
--- a/tun/tun_darwin.go
+++ b/tun/tun_darwin.go
@@ -296,8 +296,6 @@ func (tun *NativeTun) Close() error {
 	if tun.routeSocket != -1 {
 		unix.Shutdown(tun.routeSocket, unix.SHUT_RDWR)
 		err2 = unix.Close(tun.routeSocket)
-	} else if tun.events != nil {
-		close(tun.events)
 	}
 	if err1 != nil {
 		return err1
-- 
2.19.1



More information about the WireGuard mailing list