Merge rust-bitcoin/rust-bitcoin#1119: Use `listener.accept()`

b1faf63e82 Use listener.accept() (Tobin C. Harding)

Pull request description:

  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

ACKs for top commit:
  Kixunil:
    ACK b1faf63e82
  apoelstra:
    ACK b1faf63e82

Tree-SHA512: b2ead15d3108db3e01d9faab5e3521403dad6a0f4c3cf505f88fefd020110c520a89b9406484c10b04c9a34073c8abc465941577b17b5a193b54502c23b14c61
This commit is contained in:
Andrew Poelstra 2022-07-22 20:35:01 +00:00
commit 0469838648
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 1 additions and 1 deletions

View File

@ -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();