]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
rwcancel: no-op builds for windows and darwin
authorDavid Crawshaw <crawshaw@tailscale.com>
Wed, 19 Feb 2020 15:09:24 +0000 (10:09 -0500)
committerDavid Crawshaw <david@zentus.com>
Mon, 30 Mar 2020 07:41:39 +0000 (18:41 +1100)
This lets us include the package on those platforms in a
followup commit where we split out a conn package from device.
It also lets us run `go test ./...` when developing on macOS.

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
rwcancel/fdset.go
rwcancel/rwcancel.go
rwcancel/rwcancel_windows.go [new file with mode: 0644]
rwcancel/select_default.go

index 28746e66e82ac4dbc61708ab290c9555c16963d4..91bd7571dc1ec02b5f987cf68fd22618ec6318cf 100644 (file)
@@ -1,3 +1,5 @@
+// +build !windows
+
 /* SPDX-License-Identifier: MIT
  *
  * Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
index 808e6918361055382f84f135f1f9eccd2548b8f2..3c4a9edff9fd860ed7586146f49b58ab77cf8895 100644 (file)
@@ -1,8 +1,12 @@
+// +build !windows
+
 /* SPDX-License-Identifier: MIT
  *
  * Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
  */
 
+// Package rwcancel implements cancelable read/write operations on
+// a file descriptor.
 package rwcancel
 
 import (
diff --git a/rwcancel/rwcancel_windows.go b/rwcancel/rwcancel_windows.go
new file mode 100644 (file)
index 0000000..0316911
--- /dev/null
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: MIT
+
+package rwcancel
+
+type RWCancel struct {
+}
+
+func (*RWCancel) Cancel() {}
index dd23cdaa9f05f182f43c2ed31379637ef10a8b46..82e07dcd1b388105dffe5df4919f3ea0ac72b505 100644 (file)
@@ -1,4 +1,4 @@
-// +build !linux
+// +build !linux,!windows
 
 /* SPDX-License-Identifier: MIT
  *
@@ -10,5 +10,6 @@ package rwcancel
 import "golang.org/x/sys/unix"
 
 func unixSelect(nfd int, r *unix.FdSet, w *unix.FdSet, e *unix.FdSet, timeout *unix.Timeval) error {
-       return unix.Select(nfd, r, w, e, timeout)
+       _, err := unix.Select(nfd, r, w, e, timeout)
+       return err
 }