Skip to content
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