feat(network): update n2n handshake versions & add keepalive miniprotocol (#362)
This commit is contained in:
parent
4c651c0c3a
commit
b6399333da
12 changed files with 302 additions and 41 deletions
|
|
@ -2,6 +2,7 @@ use pallas::network::{
|
|||
facades::PeerClient,
|
||||
miniprotocols::{chainsync, Point, MAINNET_MAGIC},
|
||||
};
|
||||
use tokio::time::Instant;
|
||||
use tracing::info;
|
||||
|
||||
async fn do_blockfetch(peer: &mut PeerClient) {
|
||||
|
|
@ -35,7 +36,12 @@ async fn do_chainsync(peer: &mut PeerClient) {
|
|||
|
||||
info!("intersected point is {:?}", point);
|
||||
|
||||
let mut keepalive_timer = Instant::now();
|
||||
for _ in 0..10 {
|
||||
if keepalive_timer.elapsed().as_secs() > 20 {
|
||||
peer.keepalive().send_keepalive().await.unwrap();
|
||||
keepalive_timer = Instant::now();
|
||||
}
|
||||
let next = peer.chainsync().request_next().await.unwrap();
|
||||
|
||||
match next {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue