mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-09 23:12:40 -04:00
Properly handle concurrent messages to and from peers
Previously, we were forwarding incoming messages from peers to all swaps that were currently running. That is obviously wrong. The new design scopes an `EventLoopHandle` to a specific PeerId to avoid this problem.
This commit is contained in:
parent
95acbc6277
commit
a57f88d1b4
9 changed files with 98 additions and 157 deletions
|
@ -32,6 +32,7 @@ pub enum OutEvent {
|
|||
EncryptedSignature {
|
||||
msg: Box<EncryptedSignature>,
|
||||
channel: ResponseChannel<()>,
|
||||
peer: PeerId,
|
||||
},
|
||||
ResponseSent, // Same variant is used for all messages as no processing is done
|
||||
Failure(Error),
|
||||
|
@ -140,9 +141,10 @@ impl From<encrypted_signature::OutEvent> for OutEvent {
|
|||
fn from(event: encrypted_signature::OutEvent) -> Self {
|
||||
use crate::protocol::alice::encrypted_signature::OutEvent::*;
|
||||
match event {
|
||||
MsgReceived { msg, channel } => OutEvent::EncryptedSignature {
|
||||
MsgReceived { msg, channel, peer } => OutEvent::EncryptedSignature {
|
||||
msg: Box::new(msg),
|
||||
channel,
|
||||
peer,
|
||||
},
|
||||
AckSent => OutEvent::ResponseSent,
|
||||
Failure(err) => OutEvent::Failure(err.context("Failure with Encrypted Signature")),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue