Skip to content

Commit d07ea40

Browse files
committed
Upgrade stop-token
1 parent 7ddd1c1 commit d07ea40

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async-std = { version = "1.8.0", default-features = false, features = ["std"] }
3131
pin-utils = "0.1.0-alpha.4"
3232
futures = "0.3.15"
3333
ouroboros = "0.9"
34-
stop-token = "0.2"
34+
stop-token = "0.7"
3535
byte-pool = "0.2.2"
3636
once_cell = "1.8.0"
3737
log = "0.4.8"

src/extensions/idle.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use async_std::prelude::*;
99
use async_std::stream::Stream;
1010
use futures::task::{Context, Poll};
1111
use imap_proto::{RequestId, Response, Status};
12+
use stop_token::prelude::*;
1213

1314
use crate::client::Session;
1415
use crate::error::Result;
@@ -111,10 +112,10 @@ impl<T: Read + Write + Unpin + fmt::Debug + Send> Handle<T> {
111112

112113
let interrupt = stop_token::StopSource::new();
113114
let raw_stream = IdleStream::new(self);
114-
let mut interruptible_stream = interrupt.stop_token().stop_stream(raw_stream);
115+
let mut interruptible_stream = raw_stream.timeout_at(interrupt.token());
115116

116117
let fut = async move {
117-
while let Some(resp) = interruptible_stream.next().await {
118+
while let Some(Ok(resp)) = interruptible_stream.next().await {
118119
let resp = resp?;
119120
match resp.parsed() {
120121
Response::Data { status, .. } if status == &Status::Ok => {

0 commit comments

Comments
 (0)