This commit is contained in:
Nikolay Kim 2025-03-27 14:21:28 +01:00
parent 6cdb42a906
commit 2e0b9e0346

View file

@ -197,14 +197,13 @@ impl Accept {
fn poll(&mut self) {
log::trace!("Starting server accept loop");
let _ = self.tx.take().unwrap().send(());
// Create storage for events
let mut events = Events::with_capacity(NonZeroUsize::new(512).unwrap());
let mut timeout = Some(Duration::ZERO);
loop {
println!("------- ACCEPT LOOP");
if let Err(e) = self.poller.wait(&mut events, None) {
if let Err(e) = self.poller.wait(&mut events, timeout) {
println!("------- ACCEPT LOOP ERR: {:?}", e);
if e.kind() == io::ErrorKind::Interrupted {
continue;
@ -213,6 +212,11 @@ impl Accept {
}
}
if timeout.is_some() {
timeout = None;
let _ = self.tx.take().unwrap().send(());
}
println!("------- ACCEPTING: {:?}", events.len());
for idx in 0..self.sockets.len() {
if !self.sockets[idx].registered.get() {