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
This commit is contained in:
Tobin C. Harding 2022-07-22 13:29:05 +10:00
parent 2256d4634c
commit b1faf63e82
1 changed files with 1 additions and 1 deletions

View File

@ -193,7 +193,7 @@ mod test {
// in async mode // in async mode
let handle = thread::spawn(move || { let handle = thread::spawn(move || {
// We only simulate a single connection. // We only simulate a single connection.
let mut ostream = listener.incoming().next().unwrap().unwrap(); let (mut ostream, _) = listener.accept().unwrap();
for piece in pieces { for piece in pieces {
ostream.write_all(&piece[..]).unwrap(); ostream.write_all(&piece[..]).unwrap();
ostream.flush().unwrap(); ostream.flush().unwrap();