mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Add keep-alive timeout to coordinator
The Heartbeat was meant to serve for this, yet no Heartbeats are fired when we don't have active tributaries. libp2p does offer an explicit KeepAlive protocol, yet it's not recommended in prod. While this likely has the same pit falls as LibP2p's KeepAlive protocol, it's at least tailored to our timing.
This commit is contained in:
@@ -53,8 +53,8 @@ mod substrate;
|
||||
#[cfg(test)]
|
||||
pub mod tests;
|
||||
|
||||
// This is a static to satisfy lifetime expectations
|
||||
lazy_static::lazy_static! {
|
||||
// This is a static to satisfy lifetime expectations
|
||||
static ref NEW_TRIBUTARIES: RwLock<VecDeque<TributarySpec>> = RwLock::new(VecDeque::new());
|
||||
}
|
||||
|
||||
@@ -271,6 +271,8 @@ pub async fn handle_p2p<D: Db, P: P2p>(
|
||||
loop {
|
||||
let mut msg = p2p.receive().await;
|
||||
match msg.kind {
|
||||
P2pMessageKind::KeepAlive => {}
|
||||
|
||||
P2pMessageKind::Tributary(genesis) => {
|
||||
let tributaries = tributaries.read().await;
|
||||
let Some(tributary) = tributaries.get(&genesis) else {
|
||||
|
||||
Reference in New Issue
Block a user