mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-06-06 22:29:05 -04:00
Box all messages in enum
The messages are very different, best to box them and save size on the stack as an enum takes as much space on the stack than its bigger variant.
This commit is contained in:
parent
d2a1937f51
commit
a910bc2046
7 changed files with 14 additions and 14 deletions
|
@ -45,7 +45,7 @@ pub struct Behaviour {
|
|||
impl Behaviour {
|
||||
/// Alice always sends her messages as a response to a request from Bob.
|
||||
pub fn send(&mut self, channel: ResponseChannel<AliceToBob>, msg: SwapResponse) {
|
||||
let msg = AliceToBob::SwapResponse(msg);
|
||||
let msg = AliceToBob::SwapResponse(Box::new(msg));
|
||||
self.rr.send_response(channel, msg);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ impl NetworkBehaviourEventProcess<RequestResponseEvent<BobToAlice, AliceToBob>>
|
|||
} => {
|
||||
if let BobToAlice::SwapRequest(msg) = request {
|
||||
debug!("Received swap request");
|
||||
self.events.push_back(OutEvent { msg, channel })
|
||||
self.events.push_back(OutEvent { msg: *msg, channel })
|
||||
}
|
||||
}
|
||||
RequestResponseEvent::Message {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue