Skip to content

Commit 29dec59

Browse files
refactor: bind to 127.0.0.1:60000 synchronously instead of synchronising around it
1 parent a0fafc4 commit 29dec59

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

src/client.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -451,26 +451,18 @@ mod tests {
451451
// try.
452452

453453
use std::net::TcpListener;
454-
use std::sync::mpsc::channel;
455454
use std::time::{Duration, Instant};
456455

457456
let endpoint =
458457
std::env::var("TEST_ELECTRUM_TIMEOUT_PORT").unwrap_or("localhost:60000".into());
459-
let (sender, receiver) = channel();
460458

459+
let listener = TcpListener::bind("127.0.0.1:60000").unwrap();
461460
std::thread::spawn(move || {
462-
let listener = TcpListener::bind("127.0.0.1:60000").unwrap();
463-
sender.send(()).unwrap();
464-
465461
for _stream in listener.incoming() {
466462
std::thread::sleep(Duration::from_secs(60))
467463
}
468464
});
469465

470-
receiver
471-
.recv_timeout(Duration::from_secs(5))
472-
.expect("Can't start local listener");
473-
474466
let now = Instant::now();
475467
let client = Client::from_config(
476468
&endpoint,

0 commit comments

Comments
 (0)