Skip to content

Commit 8f99004

Browse files
author
Jonas Bostoen
committed
fix(transport): add Sync to a Future, unaware of the consequences
1 parent f13564f commit 8f99004

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

msg-transport/src/durable/session.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ use tokio::{
1313
};
1414
use tracing::{debug, error};
1515

16-
pub type PendingIo<Io> = Pin<Box<dyn Future<Output = io::Result<Io>> + Send>>;
16+
pub type PendingIo<Io> = Pin<Box<dyn Future<Output = io::Result<Io>> + Send + Sync>>;
1717

1818
/// A layer can be applied to pre-process a newly established IO object. If you need
1919
/// multiple layers, use a single top-level layer that contains and calls the other layers.
20-
pub trait Layer<Io: AsyncRead + AsyncWrite>: 'static {
20+
pub trait Layer<Io: AsyncRead + AsyncWrite>: Send + Sync + 'static {
2121
/// The processing method. This method is called with the IO object that
2222
/// should be processed, and returns a future that resolves to a processing error
2323
/// or the processed IO object.
@@ -97,7 +97,7 @@ pub trait UnderlyingIo: Sized + Unpin {
9797
}
9898

9999
impl UnderlyingIo for TcpStream {
100-
fn establish(addr: SocketAddr) -> Pin<Box<dyn Future<Output = io::Result<Self>> + Send>> {
100+
fn establish(addr: SocketAddr) -> PendingIo<TcpStream> {
101101
Box::pin(async move {
102102
let stream = TcpStream::connect(addr).await?;
103103
stream.set_nodelay(true)?;

0 commit comments

Comments
 (0)