diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-20 03:26:46 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-20 03:26:46 +0200 |
commit | 0a68c1ab175f8b45cb478e2a05732e1179efa0fb (patch) | |
tree | 5693c5f4f33bc49d02b4e8aa2b6692f6f5b0c946 | |
parent | e04f9543c011b67d81b85f97743dc9701ec446dc (diff) |
Fix race in stats
-rw-r--r-- | uapi.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -85,8 +85,8 @@ func ipcGetOperation(device *Device, socket *bufio.ReadWriter) *IPCError { send(fmt.Sprintf("last_handshake_time_sec=%d", secs)) send(fmt.Sprintf("last_handshake_time_nsec=%d", nano)) - send(fmt.Sprintf("tx_bytes=%d", peer.stats.txBytes)) - send(fmt.Sprintf("rx_bytes=%d", peer.stats.rxBytes)) + send(fmt.Sprintf("tx_bytes=%d", atomic.LoadUint64(&peer.stats.txBytes))) + send(fmt.Sprintf("rx_bytes=%d", atomic.LoadUint64(&peer.stats.rxBytes))) send(fmt.Sprintf("persistent_keepalive_interval=%d", peer.persistentKeepaliveInterval)) for _, ip := range device.allowedips.EntriesForPeer(peer) { |