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
9 changes: 9 additions & 0 deletions miner-apps/jd-client/src/lib/channel_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,13 +476,21 @@ impl ChannelManager {
})?;

let task_manager_clone = task_manager.clone();
// Register the listener task in fallback coordination, so fallback waits
// for this accept loop to stop before attempting to re-bind the same port.
let fallback_handler = fallback_coordinator.register();
let fallback_token = fallback_coordinator.token();
task_manager.spawn(async move {
loop {
select! {
_ = cancellation_token.cancelled() => {
info!("Downstream Server: received shutdown signal");
break;
}
_ = fallback_token.cancelled() => {
info!("Downstream Server: received fallback signal");
break;
}
res = server.accept() => {
match res {
Ok((stream, socket_address)) => {
Expand Down Expand Up @@ -568,6 +576,7 @@ impl ChannelManager {
}
}
info!("Downstream server: Unified loop break");
fallback_handler.done();
});
Ok(())
}
Expand Down
Loading