tokio 1.0: use ReceiverStream from tokio-stream
to wrap a Receiver in a Stream. this will likely move back into tokio proper once we have a std Stream.. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
@ -12,6 +12,7 @@ use futures::future::FutureExt;
|
||||
use futures::stream::{StreamExt, TryStreamExt};
|
||||
use serde_json::{json, Value};
|
||||
use tokio::sync::mpsc;
|
||||
use tokio_stream::wrappers::ReceiverStream;
|
||||
use xdg::BaseDirectories;
|
||||
|
||||
use pathpatterns::{MatchEntry, MatchType, PatternFlag};
|
||||
@ -306,7 +307,7 @@ async fn backup_directory<P: AsRef<Path>>(
|
||||
|
||||
let (mut tx, rx) = mpsc::channel(10); // allow to buffer 10 chunks
|
||||
|
||||
let stream = rx
|
||||
let stream = ReceiverStream::new(rx)
|
||||
.map_err(Error::from);
|
||||
|
||||
// spawn chunker inside a separate task so that it can run parallel
|
||||
|
@ -6,6 +6,7 @@ use anyhow::{bail, format_err, Error};
|
||||
use futures::*;
|
||||
use hyper;
|
||||
use openssl::ssl::{SslMethod, SslAcceptor, SslFiletype};
|
||||
use tokio_stream::wrappers::ReceiverStream;
|
||||
|
||||
use proxmox::try_block;
|
||||
use proxmox::api::RpcEnvironmentType;
|
||||
@ -122,7 +123,7 @@ async fn run() -> Result<(), Error> {
|
||||
|listener, ready| {
|
||||
|
||||
let connections = accept_connections(listener, acceptor, debug);
|
||||
let connections = hyper::server::accept::from_stream(connections);
|
||||
let connections = hyper::server::accept::from_stream(ReceiverStream::new(connections));
|
||||
|
||||
Ok(ready
|
||||
.and_then(|_| hyper::Server::builder(connections)
|
||||
|
Reference in New Issue
Block a user