aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2019-12-16 16:53:23 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2019-12-16 16:53:23 +0100
commitf8f404c8717fb23fec922f35163937ab01962396 (patch)
treedbeca8c0e0469859e6fd113fafeac6d1fa1f5059 /src
parentClean dead code (diff)
downloadwireguard-rs-f8f404c8717fb23fec922f35163937ab01962396.tar.xz
wireguard-rs-f8f404c8717fb23fec922f35163937ab01962396.zip
Constant renamed to be consistent with kernel WG
Diffstat (limited to '')
-rw-r--r--src/wireguard/router/constants.rs6
-rw-r--r--src/wireguard/router/device.rs5
-rw-r--r--src/wireguard/router/peer.rs2
3 files changed, 7 insertions, 6 deletions
diff --git a/src/wireguard/router/constants.rs b/src/wireguard/router/constants.rs
index 82360bb..af76299 100644
--- a/src/wireguard/router/constants.rs
+++ b/src/wireguard/router/constants.rs
@@ -1,9 +1,9 @@
// WireGuard semantics constants
-pub const MAX_STAGED_PACKETS: usize = 128;
+pub const MAX_QUEUED_PACKETS: usize = 1024;
// performance constants
-pub const PARALLEL_QUEUE_SIZE: usize = 256;
-pub const INORDER_QUEUE_SIZE: usize = PARALLEL_QUEUE_SIZE;
+pub const PARALLEL_QUEUE_SIZE: usize = MAX_QUEUED_PACKETS;
+pub const INORDER_QUEUE_SIZE: usize = MAX_QUEUED_PACKETS;
pub const MAX_INORDER_CONSUME: usize = INORDER_QUEUE_SIZE;
diff --git a/src/wireguard/router/device.rs b/src/wireguard/router/device.rs
index a12a657..f903a8e 100644
--- a/src/wireguard/router/device.rs
+++ b/src/wireguard/router/device.rs
@@ -12,6 +12,7 @@ use zerocopy::LayoutVerified;
use super::anti_replay::AntiReplay;
use super::pool::Job;
+use super::constants::PARALLEL_QUEUE_SIZE;
use super::inbound;
use super::outbound;
@@ -125,8 +126,8 @@ impl<E: Endpoint, C: Callbacks, T: tun::Writer, B: udp::Writer<E>> Drop
impl<E: Endpoint, C: Callbacks, T: tun::Writer, B: udp::Writer<E>> DeviceHandle<E, C, T, B> {
pub fn new(num_workers: usize, tun: T) -> DeviceHandle<E, C, T, B> {
// allocate shared device state
- let (queue_outbound, mut outrx) = ParallelQueue::new(num_workers, 128);
- let (queue_inbound, mut inrx) = ParallelQueue::new(num_workers, 128);
+ let (queue_outbound, mut outrx) = ParallelQueue::new(num_workers, PARALLEL_QUEUE_SIZE);
+ let (queue_inbound, mut inrx) = ParallelQueue::new(num_workers, PARALLEL_QUEUE_SIZE);
let device = Device {
inner: Arc::new(DeviceInner {
inbound: tun,
diff --git a/src/wireguard/router/peer.rs b/src/wireguard/router/peer.rs
index ebc0aac..23a3e62 100644
--- a/src/wireguard/router/peer.rs
+++ b/src/wireguard/router/peer.rs
@@ -39,7 +39,7 @@ pub struct PeerInner<E: Endpoint, C: Callbacks, T: tun::Writer, B: udp::Writer<E
pub opaque: C::Opaque,
pub outbound: InorderQueue<Peer<E, C, T, B>, Outbound>,
pub inbound: InorderQueue<Peer<E, C, T, B>, Inbound<E, C, T, B>>,
- pub staged_packets: Mutex<ArrayDeque<[Vec<u8>; MAX_STAGED_PACKETS], Wrapping>>,
+ pub staged_packets: Mutex<ArrayDeque<[Vec<u8>; MAX_QUEUED_PACKETS], Wrapping>>,
pub keys: Mutex<KeyWheel>,
pub ekey: Mutex<Option<EncryptionState>>,
pub endpoint: Mutex<Option<E>>,