mirror of
https://github.com/Revertron/Alfis
synced 2024-11-17 03:25:43 +00:00
Fixed some network errors.
This commit is contained in:
parent
f208476ae0
commit
8c9809bc0c
@ -175,7 +175,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_port))?;
|
||||
let socket = UdpSocket::bind(("::", self.context.dns_port))?;
|
||||
|
||||
// Spawn threads for handling requests
|
||||
for thread_id in 0..self.thread_count {
|
||||
@ -290,7 +290,7 @@ impl DnsTcpServer {
|
||||
|
||||
impl DnsServer for DnsTcpServer {
|
||||
fn run_server(mut self) -> Result<()> {
|
||||
let socket = TcpListener::bind(("[::]", self.context.dns_port))?;
|
||||
let socket = TcpListener::bind(("::", self.context.dns_port))?;
|
||||
|
||||
// Spawn threads for handling requests, and create the channels
|
||||
for thread_id in 0..self.thread_count {
|
||||
|
@ -168,8 +168,11 @@ fn handle_connection_event(context: Arc<Mutex<Context>>, peers: &mut Peers, regi
|
||||
Err(_) => { return Ok(false); }
|
||||
}
|
||||
} else {
|
||||
// Consider connection as unreliable
|
||||
return Ok(false);
|
||||
// Try to reregister connection
|
||||
let peer = peers.get_mut_peer(&event.token()).expect("Error getting peer for connection");
|
||||
let mut stream = peer.get_stream();
|
||||
registry.reregister(stream, event.token(), Interest::READABLE);
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user