Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add established timestamp to peerinfo #5350

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/net/network-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use async_trait::async_trait;
use reth_eth_wire::{DisconnectReason, EthVersion, Status};
use reth_primitives::{NodeRecord, PeerId};
use reth_rpc_types::NetworkStatus;
use std::{net::SocketAddr, sync::Arc};
use std::{net::SocketAddr, sync::Arc, time::Instant};

pub use error::NetworkError;
pub use reputation::{Reputation, ReputationChangeKind};
Expand Down Expand Up @@ -131,6 +131,8 @@ pub struct PeerInfo {
pub eth_version: EthVersion,
/// The Status message the peer sent for the `eth` handshake
pub status: Arc<Status>,
/// The timestamp when the session to that peer has been established.
pub session_established: Instant,
}

/// The direction of the connection.
Expand Down
1 change: 1 addition & 0 deletions crates/net/network/src/session/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ impl ActiveSessionHandle {
client_version: self.client_version.clone(),
eth_version: self.version,
status: self.status.clone(),
session_established: self.established,
}
}
}
Expand Down
Loading