summaryrefslogtreecommitdiffstats
path: root/device/device.go
diff options
context:
space:
mode:
Diffstat (limited to 'device/device.go')
-rw-r--r--device/device.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/device/device.go b/device/device.go
index 4b131a2..3b8770b 100644
--- a/device/device.go
+++ b/device/device.go
@@ -55,9 +55,13 @@ type Device struct {
publicKey NoisePublicKey
}
+ rate struct {
+ underLoadUntil int64
+ limiter ratelimiter.Ratelimiter
+ }
+
peers struct {
- empty AtomicBool // empty reports whether len(keyMap) == 0
- sync.RWMutex // protects keyMap
+ sync.RWMutex // protects keyMap
keyMap map[NoisePublicKey]*Peer
}
@@ -65,11 +69,6 @@ type Device struct {
indexTable IndexTable
cookieChecker CookieChecker
- rate struct {
- underLoadUntil int64
- limiter ratelimiter.Ratelimiter
- }
-
pool struct {
messageBuffers *WaitPool
inboundElements *WaitPool
@@ -135,7 +134,6 @@ func removePeerLocked(device *Device, peer *Peer, key NoisePublicKey) {
// remove from peer map
delete(device.peers.keyMap, key)
- device.peers.empty.Set(len(device.peers.keyMap) == 0)
}
// changeState attempts to change the device state to match want.