mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Do not actively set KeepAlice::No
for swap_setup
Closing the connection upon completing the `swap_setup` protocol caused problems on the ASB side, because the CLI would close the connection before the last message was properly processed. This would result in swaps going into execution on the CLI side, but not on the ASB side. The CLI ensures an open connection to the ASB over the complete course of a swap. So it does not make much sense to allow a protocol to close the connection (the CLI would immediately redial). For the Alice we set the initial `KeepAlive` to `10` seconds because Bob is expected to request a spot price in reasonable time after opening a connection on the protocol. Since Tor connections can take some time we set 10 seconds fow now for resilience.
This commit is contained in:
parent
cd14e22cdf
commit
dc89a837e7
@ -228,7 +228,7 @@ impl<LR> Handler<LR> {
|
||||
latest_rate,
|
||||
resume_only,
|
||||
timeout: Duration::from_secs(120),
|
||||
keep_alive: KeepAlive::Until(Instant::now() + Duration::from_secs(5)),
|
||||
keep_alive: KeepAlive::Until(Instant::now() + Duration::from_secs(10)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -445,7 +445,6 @@ where
|
||||
}
|
||||
|
||||
if let Some(result) = futures::ready!(self.inbound_stream.poll_unpin(cx)) {
|
||||
self.keep_alive = KeepAlive::No;
|
||||
self.inbound_stream = OptionFuture::from(None);
|
||||
return Poll::Ready(ProtocolsHandlerEvent::Custom(HandlerOutEvent::Completed(
|
||||
result,
|
||||
|
@ -19,7 +19,7 @@ use libp2p::{Multiaddr, PeerId};
|
||||
use std::collections::VecDeque;
|
||||
use std::sync::Arc;
|
||||
use std::task::{Context, Poll};
|
||||
use std::time::{Duration, Instant};
|
||||
use std::time::Duration;
|
||||
use uuid::Uuid;
|
||||
use void::Void;
|
||||
|
||||
@ -112,7 +112,7 @@ impl Handler {
|
||||
timeout: Duration::from_secs(120),
|
||||
new_swaps: VecDeque::default(),
|
||||
bitcoin_wallet,
|
||||
keep_alive: KeepAlive::Until(Instant::now() + Duration::from_secs(5)),
|
||||
keep_alive: KeepAlive::Yes,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +240,6 @@ impl ProtocolsHandler for Handler {
|
||||
}
|
||||
|
||||
if let Some(result) = futures::ready!(self.outbound_stream.poll_unpin(cx)) {
|
||||
self.keep_alive = KeepAlive::No;
|
||||
self.outbound_stream = OptionFuture::from(None);
|
||||
return Poll::Ready(ProtocolsHandlerEvent::Custom(Completed(result)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user