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.
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user