Skip to content

Commit

Permalink
Merge #649
Browse files Browse the repository at this point in the history
649: Instruct Ping to keep the connection alive r=thomaseizinger a=thomaseizinger

cc `@sethsimmons` This might fix #648.

CI is going to attach a binary to the workflow, do you mind giving that one a try and see if the disconnects still appear with that?

Fixes #648.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
  • Loading branch information
bors[bot] and thomaseizinger authored Aug 18, 2021
2 parents cdb2939 + 6c44682 commit cd5a137
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- An issue where the connection between ASB and CLI would get closed prematurely.
The CLI expects to be connected to the ASB throughout the entire swap and hence reconnects as soon as the connection is closed.
This resulted in a loop of connections being established but instantly closed again because the ASB deemed the connection to not be necessary.
See issue https://github.com/comit-network/xmr-btc-swap/issues/648.

## [0.8.1] - 2021-08-16

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions swap/src/asb/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use libp2p::core::connection::ConnectionId;
use libp2p::core::muxing::StreamMuxerBox;
use libp2p::core::transport::Boxed;
use libp2p::dns::TokioDnsConfig;
use libp2p::ping::{Ping, PingEvent};
use libp2p::ping::{Ping, PingConfig, PingEvent};
use libp2p::request_response::{RequestId, ResponseChannel};
use libp2p::swarm::{
DialPeerCondition, IntoProtocolsHandler, NetworkBehaviour, NetworkBehaviourAction,
Expand Down Expand Up @@ -152,7 +152,7 @@ pub mod behaviour {
),
transfer_proof: transfer_proof::alice(),
encrypted_signature: encrypted_signature::alice(),
ping: Ping::default(),
ping: Ping::new(PingConfig::new().with_keep_alive(true)),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions swap/src/cli/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::protocol::bob::State2;
use crate::{bitcoin, env};
use anyhow::{anyhow, Error, Result};
use libp2p::core::Multiaddr;
use libp2p::ping::{Ping, PingEvent};
use libp2p::ping::{Ping, PingConfig, PingEvent};
use libp2p::request_response::{RequestId, ResponseChannel};
use libp2p::{NetworkBehaviour, PeerId};
use std::sync::Arc;
Expand Down Expand Up @@ -83,7 +83,7 @@ impl Behaviour {
transfer_proof: transfer_proof::bob(),
encrypted_signature: encrypted_signature::bob(),
redial: redial::Behaviour::new(alice, Duration::from_secs(2)),
ping: Ping::default(),
ping: Ping::new(PingConfig::new().with_keep_alive(true)),
}
}

Expand Down
2 changes: 0 additions & 2 deletions swap/src/network.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
mod impl_from_rr_event;

pub mod alice;
pub mod bob;
pub mod cbor_request_response;
pub mod encrypted_signature;
pub mod json_pull_codec;
Expand Down
1 change: 0 additions & 1 deletion swap/src/network/alice.rs

This file was deleted.

1 change: 0 additions & 1 deletion swap/src/network/bob.rs

This file was deleted.

0 comments on commit cd5a137

Please sign in to comment.