Start on a peer2 module with an alternative implementation

This commit is contained in:
Nathan Sobo
2021-08-18 21:59:13 -06:00
parent 3f5db7284d
commit 9336c02867
5 changed files with 520 additions and 35 deletions
+3 -3
View File
@@ -38,8 +38,8 @@ type ForegroundMessageHandler =
Box<dyn Fn(&mut Option<proto::Envelope>, ConnectionId) -> Option<LocalBoxFuture<'static, ()>>>;
pub struct Receipt<T> {
sender_id: ConnectionId,
message_id: u32,
pub sender_id: ConnectionId,
pub message_id: u32,
payload_type: PhantomData<T>,
}
@@ -172,7 +172,7 @@ impl Peer {
} else {
router.handle(connection_id, envelope.clone()).await;
if let Some(envelope) = proto::build_typed_envelope(connection_id, envelope) {
broadcast_incoming_messages.send(envelope).await.ok();
broadcast_incoming_messages.send(Arc::from(envelope)).await.ok();
} else {
log::error!("unable to construct a typed envelope");
}