aquatic_udp glommio: detach tasks, await them later; add debug logging

This commit is contained in:
Joakim Frostegård 2021-10-20 02:06:51 +02:00
parent 2cc357f2f2
commit 047d138b2b
4 changed files with 27 additions and 13 deletions

View file

@ -39,13 +39,21 @@ pub async fn run_request_worker(
})()
}));
let mut handles = Vec::new();
for (_, receiver) in request_receivers.streams() {
spawn_local(handle_request_stream(
let handle = spawn_local(handle_request_stream(
config.clone(),
torrents.clone(),
response_senders.clone(),
receiver,
)).await;
)).detach();
handles.push(handle);
}
for handle in handles {
handle.await;
}
}
@ -82,6 +90,8 @@ async fn handle_request_stream<S>(
),
};
::log::debug!("preparing to send response to channel: {:?}", response);
if let Err(err) = response_senders.try_send_to(producer_index, (response, addr)) {
::log::warn!("response_sender.try_send: {:?}", err);
}