node: Fix connection attempt tracking

When a DNS error occured, the `dial` call failed and we didn't get a
connection attempt, just a disconnect. We fix that by always calling
back into the service when we attempt a connection.
This commit is contained in:
cloudhead 2024-01-19 16:32:01 +01:00
parent 0fbfbc5721
commit 7b3d380ceb
No known key found for this signature in database
1 changed files with 2 additions and 2 deletions

View File

@ -773,6 +773,7 @@ where
); );
continue; continue;
} }
self.service.attempted(node_id, addr.clone());
match dial::<G>( match dial::<G>(
addr.to_inner(), addr.to_inner(),
@ -785,7 +786,6 @@ where
NetTransport::<WireSession<G>>::with_session(session, Link::Outbound) NetTransport::<WireSession<G>>::with_session(session, Link::Outbound)
}) { }) {
Ok(transport) => { Ok(transport) => {
self.service.attempted(node_id, addr.clone());
self.outbound.insert( self.outbound.insert(
transport.as_raw_fd(), transport.as_raw_fd(),
Outbound { Outbound {
@ -798,7 +798,7 @@ where
.push_back(reactor::Action::RegisterTransport(transport)); .push_back(reactor::Action::RegisterTransport(transport));
} }
Err(err) => { Err(err) => {
log::error!(target: "wire", "Error establishing connection: {err}"); log::error!(target: "wire", "Error establishing connection to {addr}: {err}");
self.service self.service
.disconnected(node_id, &DisconnectReason::Dial(Arc::new(err))); .disconnected(node_id, &DisconnectReason::Dial(Arc::new(err)));