aboutsummaryrefslogtreecommitdiff
path: root/device/peer.go
diff options
context:
space:
mode:
authorDavid Crawshaw <crawshaw@tailscale.com>2020-04-07 14:52:17 +1000
committerDavid Crawshaw <crawshaw@tailscale.com>2020-04-07 15:55:53 +1000
commita4657f996d98378c06cc7da4d2c69539c19dae32 (patch)
treee07249243098c8435543660b5cae76927d2b55c6 /device/peer.go
parentf6020a2085d9a6b911c00875752bb40bfe629e00 (diff)
downloadwireguard-go-a4657f996d98378c06cc7da4d2c69539c19dae32.tar.gz
wireguard-go-a4657f996d98378c06cc7da4d2c69539c19dae32.zip
device: move stats fields back down and add test diagnostics
This reverts the movement of fields from d49f4e9. That commit was cherry-picked from another branch where a field had changed and misaligned the atomic fields. After cherry-picking, moving the fields was no longer necessary but got dragged along. Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
Diffstat (limited to 'device/peer.go')
-rw-r--r--device/peer.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/device/peer.go b/device/peer.go
index a96f261..cb348d5 100644
--- a/device/peer.go
+++ b/device/peer.go
@@ -21,6 +21,14 @@ const (
)
type Peer struct {
+ // Mostly protects endpoint, but is generally taken whenever we modify peer
+ sync.RWMutex
+ keypairs Keypairs
+ handshake Handshake
+ device *Device
+ endpoint conn.Endpoint
+ persistentKeepaliveInterval uint16
+
// These fields are accessed with atomic operations, which must be
// 64-bit aligned even on 32-bit platforms. Go guarantees that an
// allocated struct will be 64-bit aligned. So we place
@@ -35,14 +43,6 @@ type Peer struct {
// bits. Don't place other atomic fields after this one.
isRunning AtomicBool
- // Mostly protects endpoint, but is generally taken whenever we modify peer
- sync.RWMutex
- keypairs Keypairs
- handshake Handshake
- device *Device
- endpoint conn.Endpoint
- persistentKeepaliveInterval uint16
-
timers struct {
retransmitHandshake *Timer
sendKeepalive *Timer