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

manager: Log when polling returns Ready(None) #284

Merged
merged 1 commit into from
Nov 12, 2024
Merged
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
65 changes: 48 additions & 17 deletions src/transport/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1001,29 +1001,60 @@ impl TransportManager {
pub async fn next(&mut self) -> Option<TransportEvent> {
loop {
tokio::select! {
event = self.event_rx.recv() => match event? {
TransportManagerEvent::ConnectionClosed {
peer,
connection: connection_id,
} => match self.on_connection_closed(peer, connection_id) {
None => {}
Some(event) => return Some(event),
}
event = self.event_rx.recv() => {
let Some(event) = event else {
tracing::error!(
target: LOG_TARGET,
"Installed protocols terminated, ignore if the node is stopping"
);

return None;
};

match event {
TransportManagerEvent::ConnectionClosed {
peer,
connection: connection_id,
} => if let Some(event) = self.on_connection_closed(peer, connection_id) {
return Some(event);
}
};
},
command = self.cmd_rx.recv() => match command? {
InnerTransportManagerCommand::DialPeer { peer } => {
if let Err(error) = self.dial(peer).await {
tracing::debug!(target: LOG_TARGET, ?peer, ?error, "failed to dial peer")

command = self.cmd_rx.recv() =>{
let Some(command) = command else {
tracing::error!(
target: LOG_TARGET,
"User command terminated, ignore if the node is stopping"
);

return None;
};

match command {
InnerTransportManagerCommand::DialPeer { peer } => {
if let Err(error) = self.dial(peer).await {
tracing::debug!(target: LOG_TARGET, ?peer, ?error, "failed to dial peer")
}
}
}
InnerTransportManagerCommand::DialAddress { address } => {
if let Err(error) = self.dial_address(address).await {
tracing::debug!(target: LOG_TARGET, ?error, "failed to dial peer")
InnerTransportManagerCommand::DialAddress { address } => {
if let Err(error) = self.dial_address(address).await {
tracing::debug!(target: LOG_TARGET, ?error, "failed to dial peer")
}
}
}
},

event = self.transports.next() => {
let (transport, event) = event?;
let Some((transport, event)) = event else {
tracing::error!(
target: LOG_TARGET,
"Installed transports terminated, ignore if the node is stopping"
);

return None;
};


match event {
TransportEvent::DialFailure { connection_id, address, error } => {
Expand Down