dropping messages if there are no clients connected

This commit is contained in:
Godmode Galactus 2024-11-25 20:51:06 +01:00
parent 86f29e6972
commit bd9bad2eed
No known key found for this signature in database
GPG Key ID: A6B75566742EA987
2 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,7 @@ use super::quiche_server_loop::server_loop;
pub struct QuicServer {
pub data_channel_sender: mio_channel::Sender<ChannelMessage>,
pub quic_plugin_config: ConfigQuicPlugin,
_server_loop_jh: std::thread::JoinHandle<()>,
}
impl Debug for QuicServer {
@ -38,6 +39,7 @@ impl QuicServer {
Ok(QuicServer {
data_channel_sender,
quic_plugin_config: config,
_server_loop_jh,
})
}

View File

@ -230,6 +230,12 @@ pub fn server_loop(
}
if events.iter().any(|x| x.token() == Token(1)) {
if clients.is_empty() {
// no clients, no need to process messages
while message_send_queue.try_recv().is_ok() {
// do nothing / clearing the queue
}
}
// check if streams are already full, avoid depiling messages if it is full
if !clients.iter().all(|x| {
if x.1.partial_responses.is_empty() {