mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
Update ifconfig_windows.go
OLE calls sometimes unexpectedly fail, but retries can succeed. Change panic() to return errors. This way ConfigureInterface() retries can succeed.
This commit is contained in:
parent
9669b85b41
commit
8296c934ac
@ -184,26 +184,26 @@ func setFirewall(ifcGUID *windows.GUID) (bool, error) {
|
|||||||
c := ole.Connection{}
|
c := ole.Connection{}
|
||||||
err := c.Initialize()
|
err := c.Initialize()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
return false, fmt.Errorf("c.Initialize: %v", err)
|
||||||
}
|
}
|
||||||
defer c.Uninitialize()
|
defer c.Uninitialize()
|
||||||
|
|
||||||
m, err := winnet.NewNetworkListManager(&c)
|
m, err := winnet.NewNetworkListManager(&c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
return false, fmt.Errorf("winnet.NewNetworkListManager: %v", err)
|
||||||
}
|
}
|
||||||
defer m.Release()
|
defer m.Release()
|
||||||
|
|
||||||
cl, err := m.GetNetworkConnections()
|
cl, err := m.GetNetworkConnections()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
return false, fmt.Errorf("m.GetNetworkConnections: %v", err)
|
||||||
}
|
}
|
||||||
defer cl.Release()
|
defer cl.Release()
|
||||||
|
|
||||||
for _, nco := range cl {
|
for _, nco := range cl {
|
||||||
aid, err := nco.GetAdapterId()
|
aid, err := nco.GetAdapterId()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
return false, fmt.Errorf("nco.GetAdapterId: %v", err)
|
||||||
}
|
}
|
||||||
if aid != ifcGUID.String() {
|
if aid != ifcGUID.String() {
|
||||||
log.Printf("skipping adapter id: %v\n", aid)
|
log.Printf("skipping adapter id: %v\n", aid)
|
||||||
|
Loading…
Reference in New Issue
Block a user