summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipc/src/lib.rs14
1 files changed, 1 insertions, 13 deletions
diff --git a/ipc/src/lib.rs b/ipc/src/lib.rs
index c4946816..364a58b0 100644
--- a/ipc/src/lib.rs
+++ b/ipc/src/lib.rs
@@ -231,22 +231,10 @@ impl Descriptor {
}
}
- /// Try to create a TCP socket, bind it to a random port on
- /// localhost.
- fn listen(&self) -> Result<TcpListener> {
- let port = OsRng.next_u32() as u16;
- Ok(TcpListener::bind((LOCALHOST, port))?)
- }
-
/// Start the service, either as an external process or as a
/// thread.
fn start(&self, external: bool) -> Result<SocketAddr> {
- /* Listen on a random port on localhost. */
- let mut listener = self.listen();
- while listener.is_err() {
- listener = self.listen();
- }
- let listener = listener.unwrap();
+ let listener = TcpListener::bind((LOCALHOST, 0)).unwrap();
let addr = listener.local_addr()?;
/* Start the server, connect to it, and send the cookie. */