summaryrefslogtreecommitdiffstats
path: root/rwcancel
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-01-03 19:04:00 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-02-05 12:59:42 +0100
commit89d2c5ed7a054bc05a21209d5a9c79ad7151f8f7 (patch)
treee19022fe717ddfb840599bf68e4c5a9268f8c278 /rwcancel
parentUpdate copyright (diff)
downloadwireguard-go-89d2c5ed7a054bc05a21209d5a9c79ad7151f8f7.tar.xz
wireguard-go-89d2c5ed7a054bc05a21209d5a9c79ad7151f8f7.zip
Extend structs rather than embed, when possible
Diffstat (limited to 'rwcancel')
-rw-r--r--rwcancel/fdset.go6
-rw-r--r--rwcancel/rwcancel.go4
2 files changed, 5 insertions, 5 deletions
diff --git a/rwcancel/fdset.go b/rwcancel/fdset.go
index a46cfc7..28746e6 100644
--- a/rwcancel/fdset.go
+++ b/rwcancel/fdset.go
@@ -8,15 +8,15 @@ package rwcancel
import "golang.org/x/sys/unix"
type fdSet struct {
- fdset unix.FdSet
+ unix.FdSet
}
func (fdset *fdSet) set(i int) {
bits := 32 << (^uint(0) >> 63)
- fdset.fdset.Bits[i/bits] |= 1 << uint(i%bits)
+ fdset.Bits[i/bits] |= 1 << uint(i%bits)
}
func (fdset *fdSet) check(i int) bool {
bits := 32 << (^uint(0) >> 63)
- return (fdset.fdset.Bits[i/bits] & (1 << uint(i%bits))) != 0
+ return (fdset.Bits[i/bits] & (1 << uint(i%bits))) != 0
}
diff --git a/rwcancel/rwcancel.go b/rwcancel/rwcancel.go
index 83c91a7..3984310 100644
--- a/rwcancel/rwcancel.go
+++ b/rwcancel/rwcancel.go
@@ -59,7 +59,7 @@ func (rw *RWCancel) ReadyRead() bool {
fdset := fdSet{}
fdset.set(rw.fd)
fdset.set(closeFd)
- err := unixSelect(max(rw.fd, closeFd)+1, &fdset.fdset, nil, nil, nil)
+ err := unixSelect(max(rw.fd, closeFd)+1, &fdset.FdSet, nil, nil, nil)
if err != nil {
return false
}
@@ -74,7 +74,7 @@ func (rw *RWCancel) ReadyWrite() bool {
fdset := fdSet{}
fdset.set(rw.fd)
fdset.set(closeFd)
- err := unixSelect(max(rw.fd, closeFd)+1, nil, &fdset.fdset, nil, nil)
+ err := unixSelect(max(rw.fd, closeFd)+1, nil, &fdset.FdSet, nil, nil)
if err != nil {
return false
}