]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
winrio: test that IOCP-based RIO is supported
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 6 Apr 2021 17:45:10 +0000 (11:45 -0600)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 9 Apr 2021 20:26:08 +0000 (14:26 -0600)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
conn/winrio/rio_windows.go

index 2f13ec89451edb7c2c26855c021fbbe3138c7745..0a07c6507558c9613fbec609b68829f926c62f3a 100644 (file)
@@ -118,9 +118,17 @@ func Initialize() bool {
                if err != nil {
                        return
                }
+
                // While we should be able to stop here, after getting the function pointers, some anti-virus actually causes
                // failures in RIOCreateRequestQueue, so keep going to be certain this is supported.
-               cq, err = CreatePolledCompletionQueue(2)
+               var iocp windows.Handle
+               iocp, err = windows.CreateIoCompletionPort(windows.InvalidHandle, 0, 0, 0)
+               if err != nil {
+                       return
+               }
+               defer windows.CloseHandle(iocp)
+               var overlapped windows.Overlapped
+               cq, err = CreateIOCPCompletionQueue(2, iocp, 0, &overlapped)
                if err != nil {
                        return
                }