generated from PlexSheep/rs-base
We have a server at least #3
|
@ -43,20 +43,27 @@ impl Server {
|
|||
loop {
|
||||
self.work.poll(&mut self.events, self.timeout)?;
|
||||
for event in self.events.iter() {
|
||||
// self.pool.execute(|| {
|
||||
let result = self.handle_event(event);
|
||||
if let Err(err) = result {
|
||||
error!("Error while handling server event {:?}: {:?}", event, err);
|
||||
}
|
||||
// });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_event(&self, event: &Event) -> Result<()> {
|
||||
dbg!(event);
|
||||
let _connection = self.server.accept()?;
|
||||
info!("received a connection!");
|
||||
let connection = match self.server.accept() {
|
||||
Ok(c) => c,
|
||||
Err(err) => {
|
||||
error!("error while handling connection: {:?}", err);
|
||||
return Err(err.into());
|
||||
}
|
||||
};
|
||||
self.pool.execute(move|| {
|
||||
dbg!(connection);
|
||||
info!("received a connection!");
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue