From 191b0755712977718d291da9f4ad75b31ebff08f Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 31 Aug 2019 19:06:33 -0600 Subject: winipcfg: launch callbacks in goroutines to prevent deadlock ret: setupLock interfaceChangeLock trigger: interfaceChangeLock setupLock Signed-off-by: Jason A. Donenfeld --- tunnel/winipcfg/interface_change_handler.go | 2 +- tunnel/winipcfg/route_change_handler.go | 2 +- tunnel/winipcfg/unicast_address_change_handler.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tunnel') diff --git a/tunnel/winipcfg/interface_change_handler.go b/tunnel/winipcfg/interface_change_handler.go index 6bb8cf2b..50ea6448 100644 --- a/tunnel/winipcfg/interface_change_handler.go +++ b/tunnel/winipcfg/interface_change_handler.go @@ -66,7 +66,7 @@ func (callback *InterfaceChangeCallback) Unregister() error { func interfaceChanged(callerContext uintptr, row *MibIPInterfaceRow, notificationType MibNotificationType) uintptr { interfaceChangeMutex.Lock() for cb := range interfaceChangeCallbacks { - cb.cb(notificationType, row) + go cb.cb(notificationType, row) } interfaceChangeMutex.Unlock() return 0 diff --git a/tunnel/winipcfg/route_change_handler.go b/tunnel/winipcfg/route_change_handler.go index e43fa3c0..4bdea672 100644 --- a/tunnel/winipcfg/route_change_handler.go +++ b/tunnel/winipcfg/route_change_handler.go @@ -73,7 +73,7 @@ func (callback *RouteChangeCallback) Unregister() error { func routeChanged(callerContext uintptr, row *MibIPforwardRow2, notificationType MibNotificationType) uintptr { routeChangeMutex.Lock() for cb := range routeChangeCallbacks { - cb.cb(notificationType, row) + go cb.cb(notificationType, row) } routeChangeMutex.Unlock() return 0 diff --git a/tunnel/winipcfg/unicast_address_change_handler.go b/tunnel/winipcfg/unicast_address_change_handler.go index b0ae7950..b126e2ed 100644 --- a/tunnel/winipcfg/unicast_address_change_handler.go +++ b/tunnel/winipcfg/unicast_address_change_handler.go @@ -66,7 +66,7 @@ func (callback *UnicastAddressChangeCallback) Unregister() error { func unicastAddressChanged(callerContext uintptr, row *MibUnicastIPAddressRow, notificationType MibNotificationType) uintptr { unicastAddressChangeMutex.Lock() for cb := range unicastAddressChangeCallbacks { - cb.cb(notificationType, row) + go cb.cb(notificationType, row) } unicastAddressChangeMutex.Unlock() return 0 -- cgit v1.2.3-59-g8ed1b