Added a profound error message in case DNS servers could not bind.

This commit is contained in:
Revertron
2021-04-03 21:09:55 +02:00
parent ed3150cf4a
commit cde1ccb6f7
2 changed files with 5 additions and 4 deletions
+4 -2
View File
@@ -181,7 +181,8 @@ impl DnsServer for DnsUdpServer {
/// This method takes ownership of the server, preventing the method from being called multiple times.
fn run_server(self) -> Result<()> {
// 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
for thread_id in 0..self.thread_count {
@@ -302,7 +303,8 @@ impl DnsTcpServer {
impl DnsServer for DnsTcpServer {
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
for thread_id in 0..self.thread_count {