use super::{ConnectionActor, drain::ActorStep, event::Event};
use crate::{
app::Packet,
correlation::CorrelatableFrame,
push::FrameLike,
response::WireframeError,
};
impl<F, E, P> ConnectionActor<F, E, P>
where
F: FrameLike + CorrelatableFrame + Packet,
E: std::fmt::Debug,
P: FrameLike,
{
pub(super) fn dispatch_event(
&mut self,
event: Event<F, E, P>,
step: &mut ActorStep<'_, F, P>,
) -> Result<(), WireframeError<E>> {
match event {
Event::Shutdown => self.process_shutdown(step.state),
Event::High(res) => self.process_high(res, step),
Event::Low(res) => self.process_low(res, step),
Event::MultiPacket(res) => self.process_multi_packet(res, step),
Event::Response(res) => self.process_response(res, step.state, step.out)?,
Event::Idle | Event::PeerClosed => {}
}
Ok(())
}
}