fix bug and somewhat reusable streams

This commit is contained in:
Jun Kurihara 2022-07-06 13:16:44 +09:00
commit aa95ab9c16
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
3 changed files with 19 additions and 12 deletions

View file

@ -144,11 +144,19 @@ where
let peekable_incoming = std::pin::Pin::new(&mut p);
if let Some(conn) = peekable_incoming.get_mut().next().await {
if success {
// TODO: client数の管理
let clients_count = self.globals.clients_count.clone();
if clients_count.increment() > self.globals.max_clients {
clients_count.decrement();
continue;
}
let fut = self.clone().client_serve_h3(conn);
self.globals.runtime_handle.spawn(async {
self.globals.runtime_handle.spawn(async move {
if let Err(e) = fut.await {
warn!("QUIC or HTTP/3 connection failed: {}", e)
}
clients_count.decrement();
debug!("Client #: {}", clients_count.current());
});
}
} else {