Preemptively Box few messages

This commit is contained in:
Franck Royer 2021-02-04 11:38:06 +11:00
parent 3fa4ffa82c
commit ecb54958ee
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 9 additions and 6 deletions

View File

@ -230,7 +230,7 @@ pub enum OutEvent {
channel: ResponseChannel<AliceToBob>,
},
Message1 {
msg: bob::Message1,
msg: Box<bob::Message1>,
channel: ResponseChannel<AliceToBob>,
},
Message2 {
@ -239,7 +239,7 @@ pub enum OutEvent {
},
ExecutionSetupDone(Result<Box<State3>>),
TransferProofAcknowledged,
EncryptedSignature(EncryptedSignature),
EncryptedSignature(Box<EncryptedSignature>),
}
impl From<peer_tracker::OutEvent> for OutEvent {
@ -272,7 +272,10 @@ impl From<message0::OutEvent> for OutEvent {
impl From<message1::OutEvent> for OutEvent {
fn from(event: message1::OutEvent) -> Self {
match event {
message1::OutEvent::Msg { msg, channel } => OutEvent::Message1 { msg, channel },
message1::OutEvent::Msg { msg, channel } => OutEvent::Message1 {
msg: Box::new(msg),
channel,
},
}
}
}
@ -307,7 +310,7 @@ impl From<transfer_proof::OutEvent> for OutEvent {
impl From<encrypted_signature::OutEvent> for OutEvent {
fn from(event: encrypted_signature::OutEvent) -> Self {
match event {
encrypted_signature::OutEvent::Msg(msg) => OutEvent::EncryptedSignature(msg),
encrypted_signature::OutEvent::Msg(msg) => OutEvent::EncryptedSignature(Box::new(msg)),
}
}
}

View File

@ -244,7 +244,7 @@ impl EventLoop {
let _ = self.recv_message0.send((*msg, channel)).await;
}
OutEvent::Message1 { msg, channel } => {
let _ = self.recv_message1.send((msg, channel)).await;
let _ = self.recv_message1.send((*msg, channel)).await;
}
OutEvent::Message2 { msg, bob_peer_id : _} => {
let _ = self.recv_message2.send(*msg).await;
@ -257,7 +257,7 @@ impl EventLoop {
let _ = self.recv_transfer_proof_ack.send(()).await;
}
OutEvent::EncryptedSignature(msg) => {
let _ = self.recv_encrypted_signature.send(msg).await;
let _ = self.recv_encrypted_signature.send(*msg).await;
}
OutEvent::Request(event) => {
let _ = self.request.send(*event).await;