From c3cec63a95966d8578e4bae61df8f98fe0072625 Mon Sep 17 00:00:00 2001 From: Ignotus Peverell Date: Wed, 28 Mar 2018 23:59:42 +0100 Subject: [PATCH] Use a sync channel for peer sending. Fixes #904 --- p2p/src/conn.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/p2p/src/conn.rs b/p2p/src/conn.rs index 521381af7..a7ed47405 100644 --- a/p2p/src/conn.rs +++ b/p2p/src/conn.rs @@ -142,7 +142,7 @@ pub struct Tracker { /// Bytes we've received. pub received_bytes: Arc>, /// Channel to allow sending data through the connection - pub send_channel: mpsc::Sender>, + pub send_channel: mpsc::SyncSender>, /// Channel to close the connection pub close_channel: mpsc::Sender<()>, /// Channel to check for errors on the connection @@ -167,7 +167,7 @@ pub fn listen(stream: TcpStream, handler: H) -> Tracker where H: MessageHandler, { - let (send_tx, send_rx) = mpsc::channel(); + let (send_tx, send_rx) = mpsc::sync_channel(10); let (close_tx, close_rx) = mpsc::channel(); let (error_tx, error_rx) = mpsc::channel();