Skip to content

Commit 283d0cb

Browse files
refactor: bind to 127.0.0.1:60000 synchronously instead of synchronising around it
1 parent 0339d62 commit 283d0cb

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
@@ -459,26 +459,18 @@ mod tests {
459459
// try.
460460

461461
use std::net::TcpListener;
462-
use std::sync::mpsc::channel;
463462
use std::time::{Duration, Instant};
464463

465464
let endpoint =
466465
std::env::var("TEST_ELECTRUM_TIMEOUT_PORT").unwrap_or("localhost:60000".into());
467-
let (sender, receiver) = channel();
468466

467+
let listener = TcpListener::bind("127.0.0.1:60000").unwrap();
469468
std::thread::spawn(move || {
470-
let listener = TcpListener::bind("127.0.0.1:60000").unwrap();
471-
sender.send(()).unwrap();
472-
473469
for _stream in listener.incoming() {
474470
std::thread::sleep(Duration::from_secs(60))
475471
}
476472
});
477473

478-
receiver
479-
.recv_timeout(Duration::from_secs(5))
480-
.expect("Can't start local listener");
481-
482474
let now = Instant::now();
483475
let client = Client::from_config(
484476
&endpoint,

0 commit comments

Comments
 (0)