Skip to contentSkip to conversation

tun: darwin: fix panic: close of closed channel

PATCH In review [email protected] 2 participants 3 messages Aug 25, 2019 – Aug 26, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tun: darwin: fix panic: close of closed channel

From: liuhaichao <[email protected]>

Change-Id: Idd77fef05316f817e03a0f905ac5e6d53a6865f7

---
 tun/tun_darwin.go | 2 --
 1 file changed, 2 deletions(-)
tun/tun_darwin.go +0 -2
index 0815495..07abc6b 100644
@@ -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
Signature · 6 lines
2.19.1

_______________________________________________
WireGuard mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/wireguard
author
#2 lore raw

I used the previous version, so this bug was triggered. But why should we close tun.events in two places.

Quoted 6 lines · 在 2019年8月25日,23:22,Jason A. Donenfeld <[email protected]> 写道:

I was under the impression this was fixed with
https://git.zx2c4.com/wireguard-go/commit/?id=6d78f895579b114c93bd493ad8d61316fc5dd15a

What precisely is the bug you're seeing?

_______________________________________________
WireGuard mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/wireguard