Make Pollee stateless

This commit is contained in:
Ruihan Li
2024-11-13 23:39:55 +08:00
committed by Tate, Hongliang Tian
parent 5450d0bd71
commit fab61f5f66
30 changed files with 514 additions and 430 deletions

View File

@ -3,9 +3,19 @@
/// A observer that will be invoked whenever events occur on the socket.
pub trait SocketEventObserver: Send + Sync {
/// Notifies that events occurred on the socket.
fn on_events(&self);
fn on_events(&self, events: SocketEvents);
}
impl SocketEventObserver for () {
fn on_events(&self) {}
fn on_events(&self, _events: SocketEvents) {}
}
bitflags::bitflags! {
/// Socket events caused by the _network_.
pub struct SocketEvents: u8 {
const CAN_RECV = 1;
const CAN_SEND = 2;
const PEER_CLOSED = 4;
const CLOSED = 8;
}
}