diff options
author | Jake McGinty <me@jake.su> | 2018-06-04 00:02:39 -0500 |
---|---|---|
committer | Jake McGinty <me@jake.su> | 2018-06-04 00:02:39 -0500 |
commit | 932bb18602dbbb84ff419d6c6ac7937faea8f0a2 (patch) | |
tree | 60719f1a73a26213a7c4bcf1087e4e36ae598031 /src/crypto_pool.rs | |
parent | well, this is interesting. (diff) | |
download | wireguard-rs-932bb18602dbbb84ff419d6c6ac7937faea8f0a2.tar.xz wireguard-rs-932bb18602dbbb84ff419d6c6ac7937faea8f0a2.zip |
clean stuff up a bit
Diffstat (limited to 'src/crypto_pool.rs')
-rw-r--r-- | src/crypto_pool.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/crypto_pool.rs b/src/crypto_pool.rs index b8e4536..db5826e 100644 --- a/src/crypto_pool.rs +++ b/src/crypto_pool.rs @@ -1,6 +1,5 @@ use consts::{PADDING_MULTIPLE, TRANSPORT_OVERHEAD, TRANSPORT_HEADER_SIZE}; -use crossbeam; -use crossbeam_channel::{unbounded, Receiver, Sender}; +use crossbeam_channel::{bounded, Receiver, Sender}; use futures::sync::mpsc; use futures::executor; use futures::Sink; @@ -51,15 +50,13 @@ pub struct DecryptResult { /// the CPU-intensive encryption/decryption. pub fn create() -> Sender<Work> { let threads = num_cpus::get(); // One thread for I/O. - let (sender, receiver) = unbounded(); + let (sender, receiver) = bounded(4096); debug!("spinning up a crypto pool with {} threads", threads); - crossbeam::scope(|s| { - for _ in 0..threads { - let rx = receiver.clone(); - thread::spawn(move || worker(rx.clone())); - } - }); + for _ in 0..threads { + let rx = receiver.clone(); + thread::spawn(move || worker(rx.clone())); + } sender } |