round trip ControlMessage auth test

This commit is contained in:
Evan Feenstra
2022-09-08 14:47:58 -07:00
parent 21ed9f97ea
commit de68957cdf
11 changed files with 65 additions and 33 deletions

View File

@@ -31,9 +31,21 @@ pub struct Channel {
/// Responses are received on the oneshot sender
#[derive(Debug)]
pub struct ChannelRequest {
pub topic: String,
pub message: Vec<u8>,
pub reply_tx: oneshot::Sender<ChannelReply>,
}
impl ChannelRequest {
pub fn new(topic: &str, message: Vec<u8>) -> (Self, oneshot::Receiver<ChannelReply>) {
let (reply_tx, reply_rx) = oneshot::channel();
let cr = ChannelRequest {
topic: topic.to_string(),
message,
reply_tx,
};
(cr, reply_rx)
}
}
// mpsc reply
#[derive(Debug)]