formatting and heartbeat log
This commit is contained in:
parent
3be12f7807
commit
4ae3d05a1d
@ -1,9 +1,11 @@
|
||||
use crate::persistence::{SealError, SealedFile};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::{serde_as, TimestampSeconds};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
sync::atomic::{AtomicBool, Ordering},
|
||||
time::{Duration, SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
type IP = String;
|
||||
|
@ -6,8 +6,7 @@ use crate::{datastore::State, grpc::challenge::update_server::Update};
|
||||
use detee_sgx::RaTlsConfig;
|
||||
use rustls::pki_types::CertificateDer;
|
||||
use std::{pin::Pin, sync::Arc};
|
||||
use tokio::sync::broadcast::Sender;
|
||||
use tokio::time::interval;
|
||||
use tokio::{sync::broadcast::Sender, time::interval};
|
||||
use tokio_stream::{Stream, StreamExt};
|
||||
use tonic::{Request, Response, Status, Streaming};
|
||||
|
||||
@ -139,12 +138,12 @@ struct ConnInfo {
|
||||
|
||||
#[tonic::async_trait]
|
||||
impl Update for NodeServer {
|
||||
type GetUpdatesStream = Pin<Box<dyn Stream<Item = Result<NodeUpdate, Status>> + Send>>;
|
||||
|
||||
async fn get_keys(&self, _request: Request<Empty>) -> Result<Response<Keys>, Status> {
|
||||
Ok(Response::new(self.keys.clone()))
|
||||
}
|
||||
|
||||
type GetUpdatesStream = Pin<Box<dyn Stream<Item = Result<NodeUpdate, Status>> + Send>>;
|
||||
|
||||
async fn get_updates(
|
||||
&self,
|
||||
req: Request<Streaming<NodeUpdate>>,
|
||||
|
@ -54,7 +54,8 @@ pub async fn heartbeat(
|
||||
state.update_keepalive().await;
|
||||
state.remove_inactive_nodes().await;
|
||||
let connected_ips = state.get_connected_ips().await;
|
||||
println!("Connected nodes ({}): {:?}", connected_ips.len(), connected_ips);
|
||||
let my_ip = state.get_my_ip().await;
|
||||
println!("Connected nodes ({}): \"{}\" -> {:?}", connected_ips.len(), my_ip, connected_ips);
|
||||
let my_node_info = state.get_my_info().await;
|
||||
my_node_info.save();
|
||||
let _ = tx.send((state.get_my_ip().await, my_node_info).into());
|
||||
|
Loading…
Reference in New Issue
Block a user