Added a profound error message in case DNS servers could not bind.
This commit is contained in:
+4
-2
@@ -181,7 +181,8 @@ impl DnsServer for DnsUdpServer {
|
|||||||
/// This method takes ownership of the server, preventing the method from being called multiple times.
|
/// This method takes ownership of the server, preventing the method from being called multiple times.
|
||||||
fn run_server(self) -> Result<()> {
|
fn run_server(self) -> Result<()> {
|
||||||
// Bind the socket
|
// Bind the socket
|
||||||
let socket = UdpSocket::bind(self.context.dns_listen.as_str())?;
|
let socket = UdpSocket::bind(self.context.dns_listen.as_str())
|
||||||
|
.expect(&format!("Cannot start DNS server on {}! Change listen address in config!", self.context.dns_listen.as_str()));
|
||||||
|
|
||||||
// Spawn threads for handling requests
|
// Spawn threads for handling requests
|
||||||
for thread_id in 0..self.thread_count {
|
for thread_id in 0..self.thread_count {
|
||||||
@@ -302,7 +303,8 @@ impl DnsTcpServer {
|
|||||||
|
|
||||||
impl DnsServer for DnsTcpServer {
|
impl DnsServer for DnsTcpServer {
|
||||||
fn run_server(mut self) -> Result<()> {
|
fn run_server(mut self) -> Result<()> {
|
||||||
let socket = TcpListener::bind(self.context.dns_listen.as_str())?;
|
let socket = TcpListener::bind(self.context.dns_listen.as_str())
|
||||||
|
.expect(&format!("Cannot start DNS server on {}! Change listen address in config!", self.context.dns_listen.as_str()));
|
||||||
|
|
||||||
// Spawn threads for handling requests, and create the channels
|
// Spawn threads for handling requests, and create the channels
|
||||||
for thread_id in 0..self.thread_count {
|
for thread_id in 0..self.thread_count {
|
||||||
|
|||||||
+1
-2
@@ -69,11 +69,10 @@ fn main() {
|
|||||||
if let Some(settings) = Settings::load(&path) {
|
if let Some(settings) = Settings::load(&path) {
|
||||||
let string = toml::to_string(&settings).unwrap();
|
let string = toml::to_string(&settings).unwrap();
|
||||||
println!("{}", &string);
|
println!("{}", &string);
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
println!("Error loading config for upgrade!");
|
println!("Error loading config for upgrade!");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user