aquatic_udp: glommio: add yield_if_needed(), add comment

This commit is contained in:
Joakim Frostegård 2021-10-19 02:11:27 +02:00
parent 93907822f8
commit 9dc615a8f9
2 changed files with 5 additions and 1 deletions

View file

@ -3,6 +3,7 @@ use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
use futures_lite::stream::empty;
use futures_lite::StreamExt;
use glommio::channels::channel_mesh::{MeshBuilder, Partial, Role};
use glommio::prelude::*;
use rand::prelude::SmallRng;
use rand::SeedableRng;
@ -56,5 +57,7 @@ pub async fn run_request_worker(
if let Err(err) = response_senders.try_send_to(producer_index, (response, addr)) {
::log::warn!("response_sender.try_send: {:?}", err);
}
yield_if_needed().await;
}
}

View file

@ -65,9 +65,10 @@ async fn read_requests(
) {
let mut rng = StdRng::from_entropy();
let valid_until = ValidUntil::new(config.cleaning.max_connection_age);
let access_list_mode = config.access_list.mode;
// Needs to be updated periodically: use timer?
let valid_until = ValidUntil::new(config.cleaning.max_connection_age);
// Needs to be updated periodically: use timer?
let access_list = AccessList::default();
// Needs to be cleaned periodically: use timer?