From b7f2ea0e6a7191c5e0fedff4764d3914ea4e3af3 Mon Sep 17 00:00:00 2001 From: fgergo Date: Fri, 21 Feb 2020 21:22:29 +0100 Subject: [PATCH] Update ifconfig_windows.go OLE calls sometimes unexpectedly fail, but retries can succeed. Change panic() to return errors. This way ConfigureInterface() retries can succeed. Signed-off-by: fgergo --- wgengine/ifconfig_windows.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wgengine/ifconfig_windows.go b/wgengine/ifconfig_windows.go index e4b082305..a83a17087 100644 --- a/wgengine/ifconfig_windows.go +++ b/wgengine/ifconfig_windows.go @@ -184,26 +184,26 @@ func setFirewall(ifcGUID *windows.GUID) (bool, error) { c := ole.Connection{} err := c.Initialize() if err != nil { - panic(err) + return false, fmt.Errorf("c.Initialize: %v", err) } defer c.Uninitialize() m, err := winnet.NewNetworkListManager(&c) if err != nil { - panic(err) + return false, fmt.Errorf("winnet.NewNetworkListManager: %v", err) } defer m.Release() cl, err := m.GetNetworkConnections() if err != nil { - panic(err) + return false, fmt.Errorf("m.GetNetworkConnections: %v", err) } defer cl.Release() for _, nco := range cl { aid, err := nco.GetAdapterId() if err != nil { - panic(err) + return false, fmt.Errorf("nco.GetAdapterId: %v", err) } if aid != ifcGUID.String() { log.Printf("skipping adapter id: %v\n", aid)