diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-11-17 19:52:40 +0100 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-11-17 19:52:40 +0100 |
commit | 64707b0471b5efe06ac2c93e350676d9d4049b72 (patch) | |
tree | 04276f7085fa90e4470986da1d66ce44faa4b24d /src/wireguard/handshake | |
parent | Update UAPI semantics for remove (diff) | |
download | wireguard-rs-64707b0471b5efe06ac2c93e350676d9d4049b72.tar.xz wireguard-rs-64707b0471b5efe06ac2c93e350676d9d4049b72.zip |
Update configuration API
Diffstat (limited to 'src/wireguard/handshake')
-rw-r--r-- | src/wireguard/handshake/device.rs | 16 | ||||
-rw-r--r-- | src/wireguard/handshake/peer.rs | 1 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/wireguard/handshake/device.rs b/src/wireguard/handshake/device.rs index 02e6929..030c0f8 100644 --- a/src/wireguard/handshake/device.rs +++ b/src/wireguard/handshake/device.rs @@ -469,6 +469,10 @@ mod tests { (pk1, dev1, pk2, dev2) } + fn wait() { + thread::sleep(Duration::from_millis(20)); + } + /* Test longest possible handshake interaction (7 messages): * * 1. I -> R (initation) @@ -502,8 +506,8 @@ mod tests { _ => panic!("unexpected response"), } - // avoid initation flood - thread::sleep(Duration::from_millis(20)); + // avoid initation flood detection + wait(); // 3. device-1 : create second initation let msg_init = dev1.begin(&mut rng, &pk2).unwrap(); @@ -529,8 +533,8 @@ mod tests { _ => panic!("unexpected response"), } - // avoid initation flood - thread::sleep(Duration::from_millis(20)); + // avoid initation flood detection + wait(); // 6. device-1 : create third initation let msg_init = dev1.begin(&mut rng, &pk2).unwrap(); @@ -600,8 +604,8 @@ mod tests { dev1.release(ks_i.send.id); dev2.release(ks_r.send.id); - // to avoid flood detection - thread::sleep(Duration::from_millis(20)); + // avoid initation flood detection + wait(); } dev1.remove(pk2).unwrap(); diff --git a/src/wireguard/handshake/peer.rs b/src/wireguard/handshake/peer.rs index abb36eb..2d69244 100644 --- a/src/wireguard/handshake/peer.rs +++ b/src/wireguard/handshake/peer.rs @@ -7,7 +7,6 @@ use generic_array::typenum::U32; use generic_array::GenericArray; use x25519_dalek::PublicKey; -use x25519_dalek::SharedSecret; use x25519_dalek::StaticSecret; use clear_on_drop::clear::Clear; |