aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJake McGinty <me@jake.su>2018-01-08 16:54:50 -0800
committerJake McGinty <me@jake.su>2018-01-08 16:54:50 -0800
commitadcb11e05e9d4634fdc8c0bb31d5cdca8fef0044 (patch)
tree4961df20ff1db4580a570935ccf36f6fab47d20f /src
parentadd more consts from the spec (diff)
downloadwireguard-rs-adcb11e05e9d4634fdc8c0bb31d5cdca8fef0044.tar.xz
wireguard-rs-adcb11e05e9d4634fdc8c0bb31d5cdca8fef0044.zip
u64 counters, not usize
Diffstat (limited to 'src')
-rw-r--r--src/interface/peer_server.rs6
-rw-r--r--src/protocol/peer.rs5
2 files changed, 6 insertions, 5 deletions
diff --git a/src/interface/peer_server.rs b/src/interface/peer_server.rs
index f66a44f..0c6c130 100644
--- a/src/interface/peer_server.rs
+++ b/src/interface/peer_server.rs
@@ -138,7 +138,7 @@ impl PeerServer {
if let Some(ref peer) = lookup {
let mut peer = peer.borrow_mut();
- peer.rx_bytes += packet.len();
+ peer.rx_bytes += packet.len() as u64;
// TODO: map index not just to peer, but to specific session instead of guessing
let res = {
@@ -192,7 +192,7 @@ impl PeerServer {
packet[0] = 4;
let their_index = peer.their_current_index().expect("no current index for them");
let endpoint = peer.info.endpoint.unwrap();
- peer.tx_bytes += packet.len();
+ peer.tx_bytes += packet.len() as u64;
let noise = peer.current_noise().expect("current noise session");
LittleEndian::write_u32(&mut packet[4..], their_index);
LittleEndian::write_u64(&mut packet[8..], noise.sending_nonce().unwrap());
@@ -214,7 +214,7 @@ impl PeerServer {
out_packet[0] = 4;
let their_index = peer.their_current_index().expect("no current index for them");
let endpoint = peer.info.endpoint.unwrap();
- peer.tx_bytes += packet.len();
+ peer.tx_bytes += packet.len() as u64;
let noise = peer.current_noise().expect("current noise session");
LittleEndian::write_u32(&mut out_packet[4..], their_index);
LittleEndian::write_u64(&mut out_packet[8..], noise.sending_nonce().unwrap());
diff --git a/src/protocol/peer.rs b/src/protocol/peer.rs
index 2010bc1..90def84 100644
--- a/src/protocol/peer.rs
+++ b/src/protocol/peer.rs
@@ -21,11 +21,12 @@ use futures::{self, Future};
use tokio_core::reactor::Handle;
use tokio_core::net::{UdpSocket, UdpCodec};
+#[derive(Default)]
pub struct Peer {
pub info: PeerInfo,
pub sessions: Sessions,
- pub tx_bytes: usize,
- pub rx_bytes: usize,
+ pub tx_bytes: u64,
+ pub rx_bytes: u64,
pub last_handshake: Option<SystemTime>,
}