Changed the way how DNS-server start error is handled. Now ALFIS starts normally, and the error is shown in GUI.

This commit is contained in:
Revertron
2021-11-20 16:11:05 +01:00
parent ab742885dd
commit 0e8d39751e
8 changed files with 47 additions and 11 deletions
+2 -4
View File
@@ -178,8 +178,7 @@ 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())
.expect(&format!("Cannot start DNS server on {}! Change listen address in config!", self.context.dns_listen.as_str()));
let socket = UdpSocket::bind(self.context.dns_listen.as_str())?;
// Spawn threads for handling requests
for thread_id in 0..self.thread_count {
@@ -310,8 +309,7 @@ impl DnsTcpServer {
impl DnsServer for DnsTcpServer {
fn run_server(mut self) -> Result<()> {
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()));
let socket = TcpListener::bind(self.context.dns_listen.as_str())?;
// Spawn threads for handling requests, and create the channels
for thread_id in 0..self.thread_count {