Fixed Ordering::Acquire -> Ordering::SeqCst typo
This commit is contained in:
@@ -7,7 +7,7 @@ use std::sync::Arc;
|
|||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
use super::super::bind::*;
|
use super::super::bind::*;
|
||||||
use super::super::Endpoint;
|
|
||||||
use super::UnitEndpoint;
|
use super::UnitEndpoint;
|
||||||
|
|
||||||
pub struct VoidOwner {}
|
pub struct VoidOwner {}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use std::cmp::min;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
@@ -84,9 +85,10 @@ impl Reader for TunReader {
|
|||||||
|
|
||||||
fn read(&self, buf: &mut [u8], offset: usize) -> Result<usize, Self::Error> {
|
fn read(&self, buf: &mut [u8], offset: usize) -> Result<usize, Self::Error> {
|
||||||
match self.rx.recv() {
|
match self.rx.recv() {
|
||||||
Ok(m) => {
|
Ok(msg) => {
|
||||||
buf[offset..].copy_from_slice(&m[..]);
|
let n = min(buf.len() - offset, msg.len());
|
||||||
Ok(m.len())
|
buf[offset..offset + n].copy_from_slice(&msg[..n]);
|
||||||
|
Ok(n)
|
||||||
}
|
}
|
||||||
Err(_) => Err(TunError::Disconnected),
|
Err(_) => Err(TunError::Disconnected),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,4 +109,6 @@ fn test_pure_wireguard() {
|
|||||||
"192.168.2.20".parse().unwrap(), // src
|
"192.168.2.20".parse().unwrap(), // src
|
||||||
"192.168.1.10".parse().unwrap(), // dst
|
"192.168.1.10".parse().unwrap(), // dst
|
||||||
);
|
);
|
||||||
|
|
||||||
|
fake1.write(packet_p1_to_p2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ impl <B: bind::Bind>PeerInner<B> {
|
|||||||
*/
|
*/
|
||||||
pub fn sent_handshake_initiation(&self) {
|
pub fn sent_handshake_initiation(&self) {
|
||||||
*self.last_handshake.lock() = SystemTime::now();
|
*self.last_handshake.lock() = SystemTime::now();
|
||||||
self.handshake_queued.store(false, Ordering::Acquire);
|
self.handshake_queued.store(false, Ordering::SeqCst);
|
||||||
self.timers_any_authenticated_packet_traversal();
|
self.timers_any_authenticated_packet_traversal();
|
||||||
self.timers_any_authenticated_packet_sent();
|
self.timers_any_authenticated_packet_sent();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user