diff --git a/server/src/quic_server.rs b/server/src/quic_server.rs index a73dbdb..7e40927 100644 --- a/server/src/quic_server.rs +++ b/server/src/quic_server.rs @@ -7,6 +7,7 @@ use super::quiche_server_loop::server_loop; pub struct QuicServer { pub data_channel_sender: mio_channel::Sender, 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, }) } diff --git a/server/src/quiche_server_loop.rs b/server/src/quiche_server_loop.rs index 5d4d8b3..32b3753 100644 --- a/server/src/quiche_server_loop.rs +++ b/server/src/quiche_server_loop.rs @@ -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() {