pub(crate) trait MetaCellHandler: Send {
// Required methods
fn expected_hop(&self) -> HopNum;
fn handle_msg(
&mut self,
msg: UnparsedRelayMsg,
reactor: &mut Circuit,
) -> Result<MetaCellDisposition>;
}
Expand description
An object that’s waiting for a meta cell (one not associated with a stream) in order to make progress.
§Background
The Reactor
can’t have async functions that send and receive cells, because its job is to
send and receive cells: if one of its functions tried to do that, it would just hang forever.
To get around this problem, the reactor can send some cells, and then make one of these
MetaCellHandler
objects, which will be run when the reply arrives.
Required Methods§
Sourcefn expected_hop(&self) -> HopNum
fn expected_hop(&self) -> HopNum
The hop we’re expecting the message to come from. This is compared against the hop from which we actually receive messages, and an error is thrown if the two don’t match.
Sourcefn handle_msg(
&mut self,
msg: UnparsedRelayMsg,
reactor: &mut Circuit,
) -> Result<MetaCellDisposition>
fn handle_msg( &mut self, msg: UnparsedRelayMsg, reactor: &mut Circuit, ) -> Result<MetaCellDisposition>
Called when the message we were waiting for arrives.
Gets a copy of the Reactor
in order to do anything it likes there.
If this function returns an error, the reactor will shut down.
Implementors§
impl<H, L, FWD, REV> MetaCellHandler for CircuitExtender<H, L, FWD, REV>where
H: ClientHandshake + HandshakeAuxDataHandler,
H::StateType: Send,
H::KeyGen: KeyGenerator,
L: CryptInit + ClientLayer<FWD, REV> + Send,
FWD: OutboundClientLayer + 'static + Send,
REV: InboundClientLayer + 'static + Send,
impl<T: MsgHandler + Send> MetaCellHandler for UserMsgHandler<T>
send-control-msg
only.