mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-08 09:07:44 +00:00
wgengine/router: lock goroutine to OS thread before using OLE [windows]
See https://github.com/tailscale/tailscale/issues/921#issuecomment-727526807 Not yet sure whether this is our problem, but it can't hurt at least, and seems like what we're supposed to do. Updates #921
This commit is contained in:
parent
7a01cd27ca
commit
fc8bc76e58
@ -11,6 +11,7 @@
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -165,6 +166,13 @@ func setPrivateNetwork(ifcGUID *windows.GUID) (bool, error) {
|
|||||||
categoryPrivate = 1
|
categoryPrivate = 1
|
||||||
categoryDomain = 2
|
categoryDomain = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Lock OS thread when using OLE, which seems to be a requirement
|
||||||
|
// from the Microsoft docs. go-ole doesn't seem to handle it automatically.
|
||||||
|
// https://github.com/tailscale/tailscale/issues/921#issuecomment-727526807
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
var c ole.Connection
|
var c ole.Connection
|
||||||
if err := c.Initialize(); err != nil {
|
if err := c.Initialize(); err != nil {
|
||||||
return false, fmt.Errorf("c.Initialize: %v", err)
|
return false, fmt.Errorf("c.Initialize: %v", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user