checkpoint
This commit is contained in:
@@ -228,24 +228,8 @@ impl NodeRef {
|
||||
|
||||
pub async fn last_connection(&self) -> Option<ConnectionDescriptor> {
|
||||
// Get the last connection and the last time we saw anything with this connection
|
||||
let (last_connection, last_seen) = self.operate(|e| {
|
||||
if let Some((last_connection, connection_ts)) = e.last_connection() {
|
||||
if let Some(last_seen_ts) = e.peer_stats().rpc_stats.last_seen_ts {
|
||||
Some((last_connection, u64::max(last_seen_ts, connection_ts)))
|
||||
} else {
|
||||
Some((last_connection, connection_ts))
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})?;
|
||||
|
||||
// Verify this connection matches the noderef filter
|
||||
if let Some(filter) = &self.filter {
|
||||
if !last_connection.matches_filter(filter) {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
let (last_connection, last_seen) =
|
||||
self.operate(|e| e.last_connection(self.filter.clone()))?;
|
||||
|
||||
// Should we check the connection table?
|
||||
if last_connection.protocol_type().is_connection_oriented() {
|
||||
@@ -263,8 +247,8 @@ impl NodeRef {
|
||||
Some(last_connection)
|
||||
}
|
||||
|
||||
pub fn clear_last_connection(&self) {
|
||||
self.operate_mut(|e| e.clear_last_connection())
|
||||
pub fn clear_last_connections(&self) {
|
||||
self.operate_mut(|e| e.clear_last_connections())
|
||||
}
|
||||
|
||||
pub fn set_last_connection(&self, connection_descriptor: ConnectionDescriptor, ts: u64) {
|
||||
|
||||
Reference in New Issue
Block a user