Skip to content

Commit

Permalink
[All] update tokio to 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rainliu committed Dec 23, 2020
1 parent c20c77b commit f304903
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 17 deletions.
6 changes: 3 additions & 3 deletions dtls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ util = { path = "../util" }
byteorder = "1.3.2"
lazy_static = "1.3.0"
rand_core = "0.5"
elliptic-curve = {version = "0.8.1", features=["default", "ecdh", "zeroize"]}
elliptic-curve = {version = "0.8.4", features=["default", "ecdh", "zeroize"]}
p256 = { version = "0.7.1", features=["default", "ecdh", "zeroize", "ecdsa"] }
#p384 = "0.4.1"
rand = "0.8.0"
Expand All @@ -22,7 +22,7 @@ aes = "0.6.0"
block-modes = "0.7.0"
aes-gcm = "0.8.0"
ccm = "0.3.0"
tokio = { version = "0.3", features = ["full"] }
tokio = { version = "1.0", features = ["full"] }
async-trait = "0.1"
x25519-dalek = "1.1.0"
signature = "1.2.2"
Expand All @@ -39,6 +39,6 @@ serde_derive = "1.0"
log = "0.4"

[dev-dependencies]
tokio-test = "0.3"
tokio-test = "0.4"
env_logger = "0.8"
chrono = "0.4.19"
10 changes: 6 additions & 4 deletions dtls/src/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,12 @@ impl Conn {

loop {
let rx = if let Some(d) = duration {
let mut timer = tokio::time::sleep(d);
let timer = tokio::time::sleep(d);
tokio::pin!(timer);

tokio::select! {
r = self.decrypted_rx.recv() => r,
_ = &mut timer => return Err(ERR_DEADLINE_EXCEEDED.clone()),
_ = timer.as_mut() => return Err(ERR_DEADLINE_EXCEEDED.clone()),
}
} else {
self.decrypted_rx.recv().await
Expand Down Expand Up @@ -399,15 +400,16 @@ impl Conn {
}];

if let Some(d) = duration {
let mut timer = tokio::time::sleep(d);
let timer = tokio::time::sleep(d);
tokio::pin!(timer);

tokio::select! {
result = self.write_packets(pkts) => {
if let Err(err) = result {
return Err(err);
}
}
_ = &mut timer => return Err(ERR_DEADLINE_EXCEEDED.clone()),
_ = timer.as_mut() => return Err(ERR_DEADLINE_EXCEEDED.clone()),
}
} else {
self.write_packets(pkts).await?;
Expand Down
5 changes: 3 additions & 2 deletions dtls/src/conn/conn_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1918,10 +1918,11 @@ async fn test_server_timeout() -> Result<(), Error> {
// Start sending ClientHello packets until server responds with first packet
tokio::spawn(async move {
loop {
let mut timer = tokio::time::sleep(Duration::from_millis(10));
let timer = tokio::time::sleep(Duration::from_millis(10));
tokio::pin!(timer);

tokio::select! {
_ = &mut timer => {
_ = timer.as_mut() => {
let result = ca_tx.send(&packet).await;
if result.is_err() {
return;
Expand Down
5 changes: 3 additions & 2 deletions dtls/src/handshaker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ impl Conn {
}
}
async fn wait(&mut self) -> Result<HandshakeState, Error> {
let mut retransmit_timer = tokio::time::sleep(self.cfg.retransmit_interval);
let retransmit_timer = tokio::time::sleep(self.cfg.retransmit_interval);
tokio::pin!(retransmit_timer);

loop {
tokio::select! {
Expand Down Expand Up @@ -350,7 +351,7 @@ impl Conn {
};
}

_ = &mut retransmit_timer =>{
_ = retransmit_timer.as_mut() =>{
trace!("[handshake:{}] {} retransmit_timer", srv_cli_str(self.state.is_client), self.current_flight.to_string());

if !self.retransmit {
Expand Down
4 changes: 2 additions & 2 deletions srtp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ sha-1 = "0.9.1"
ctr = "0.6.0"
aes = "0.6.0"
subtle = "2.1.1"
tokio = { version = "0.3", features = ["full"] }
tokio = { version = "1.0", features = ["full"] }
async-trait = "0.1"
log = "0.4"
aead = "^0.3"
aes-gcm = "^0.8"

[dev-dependencies]
tokio-test = "0.3"
tokio-test = "0.4"
lazy_static = "^1.4"
4 changes: 2 additions & 2 deletions stun/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2018"
[dependencies]
util = { path = "../util" }
lazy_static = "1.3.0"
tokio = { version = "0.3", features = ["full"] }
tokio = { version = "1.0", features = ["full"] }
rand = "0.8.0"
base64 = "0.13.0"
subtle = "2.1.1"
Expand All @@ -18,4 +18,4 @@ ring = "0.16.19"
md5 = "0.7.0"

[dev-dependencies]
tokio-test = "0.3"
tokio-test = "0.4"
4 changes: 2 additions & 2 deletions util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2018"

[dependencies]
url = "2.1.0"
tokio = { version = "0.3", features = ["full"] }
tokio = { version = "1.0", features = ["full"] }
aes-gcm = "0.8.0"
hmac = "0.10.1"
p256 = "0.7.1"
Expand All @@ -20,4 +20,4 @@ lazy_static = "1.3.0"
ring = "0.16.19"

[dev-dependencies]
tokio-test = "0.3"
tokio-test = "0.4"

0 comments on commit f304903

Please sign in to comment.