aboutsummaryrefslogtreecommitdiff
path: root/src/server/mod.rs
diff options
context:
space:
mode:
authorArne Dußin2021-02-04 11:36:16 +0100
committerArne Dußin2021-02-04 11:36:16 +0100
commitacf51dbeda9a7fc25af5fdd08ea7ad251ff41902 (patch)
treecc7b8836794a8511f310b8864468be5ae1835308 /src/server/mod.rs
parent2eaed3a08c28c386cff8974b8d1f1fa348c04b7f (diff)
downloadgraf_karto-acf51dbeda9a7fc25af5fdd08ea7ad251ff41902.tar.gz
graf_karto-acf51dbeda9a7fc25af5fdd08ea7ad251ff41902.zip
Use unspecified instead of localhost to bind
Diffstat (limited to 'src/server/mod.rs')
-rw-r--r--src/server/mod.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/server/mod.rs b/src/server/mod.rs
index 7f94453..c9550f7 100644
--- a/src/server/mod.rs
+++ b/src/server/mod.rs
@@ -10,11 +10,11 @@ use std::thread::{self, JoinHandle};
/// The default port the dedicated graf karto server runs on.
pub const DEFAULT_PORT: u16 = 44309;
-fn localhost(port: u16, ipv4: bool) -> SocketAddr {
+fn unspecified(port: u16, ipv4: bool) -> SocketAddr {
if ipv4 {
- SocketAddr::new(Ipv4Addr::LOCALHOST.into(), port)
+ SocketAddr::new(Ipv4Addr::UNSPECIFIED.into(), port)
} else {
- SocketAddr::new(Ipv6Addr::LOCALHOST.into(), port)
+ SocketAddr::new(Ipv6Addr::UNSPECIFIED.into(), port)
}
}
@@ -22,7 +22,7 @@ fn localhost(port: u16, ipv4: bool) -> SocketAddr {
/// port cannot be bound to it fails returning an error, otherwise the join handle
/// for the server thread is returned.
pub fn start_with_port(port: u16, ipv4: bool) -> Result<JoinHandle<()>, io::Error> {
- let addr = localhost(port, ipv4);
+ let addr = unspecified(port, ipv4);
let conn_man = ConnectionManager::start(addr)?;
Ok(start(conn_man))
@@ -31,7 +31,7 @@ pub fn start_with_port(port: u16, ipv4: bool) -> Result<JoinHandle<()>, io::Erro
/// Starts a thread on any free system port. Returns an error in case that's not
/// possible.
pub fn start_any_port(ipv4: bool) -> Result<(JoinHandle<()>, u16), io::Error> {
- let addr = localhost(0, ipv4);
+ let addr = unspecified(0, ipv4);
let conn_man = ConnectionManager::start(addr)?;
let port = conn_man.port();