From b1faf63e827e2607f4cf94f0600762cadf1a67c7 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 22 Jul 2022 13:29:05 +1000 Subject: [PATCH] Use listener.accept() During test network simulation we only accept a single connection, we can simplify the code by using `accept`. Done as a follow up to review suggestion: https://github.com/rust-bitcoin/rust-bitcoin/pull/1042#discussion_r898013799 --- src/network/stream_reader.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/stream_reader.rs b/src/network/stream_reader.rs index 6b2af321..c98bdbbc 100644 --- a/src/network/stream_reader.rs +++ b/src/network/stream_reader.rs @@ -193,7 +193,7 @@ mod test { // in async mode let handle = thread::spawn(move || { // We only simulate a single connection. - let mut ostream = listener.incoming().next().unwrap().unwrap(); + let (mut ostream, _) = listener.accept().unwrap(); for piece in pieces { ostream.write_all(&piece[..]).unwrap(); ostream.flush().unwrap();