1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-26 15:07:42 +02:00

remove usage of actix_utils::mpsc (#2023)

This commit is contained in:
Rob Ede
2021-02-24 09:08:56 +00:00
committed by GitHub
parent d92ab7e8e0
commit f6393728c7
2 changed files with 14 additions and 5 deletions

View File

@ -804,12 +804,13 @@ mod tests {
use super::*;
use actix_http::h1::Payload;
use actix_utils::mpsc;
use actix_web::http::header::{DispositionParam, DispositionType};
use actix_web::test::TestRequest;
use actix_web::FromRequest;
use bytes::Bytes;
use futures_util::future::lazy;
use tokio::sync::mpsc;
use tokio_stream::wrappers::UnboundedReceiverStream;
#[actix_rt::test]
async fn test_boundary() {
@ -855,13 +856,17 @@ mod tests {
}
fn create_stream() -> (
mpsc::Sender<Result<Bytes, PayloadError>>,
mpsc::UnboundedSender<Result<Bytes, PayloadError>>,
impl Stream<Item = Result<Bytes, PayloadError>>,
) {
let (tx, rx) = mpsc::channel();
let (tx, rx) = mpsc::unbounded_channel();
(tx, rx.map(|res| res.map_err(|_| panic!())))
(
tx,
UnboundedReceiverStream::new(rx).map(|res| res.map_err(|_| panic!())),
)
}
// Stream that returns from a Bytes, one char at a time and Pending every other poll()
struct SlowStream {
bytes: Bytes,
@ -889,9 +894,11 @@ mod tests {
cx.waker().wake_by_ref();
return Poll::Pending;
}
if this.pos == this.bytes.len() {
return Poll::Ready(None);
}
let res = Poll::Ready(Some(Ok(this.bytes.slice(this.pos..(this.pos + 1)))));
this.pos += 1;
this.ready = false;