fix: fix resource leak (#136)

When a running service is dropped, its connections should be closed and its resources should be
cleaned up.

This changes the default from leaving services running to closing them. Library users who want
their services to remain running should call `waiting` on their running service, in a new task
where necessary.

Co-authored-by: Paul Ellenbogen <pe5@cs.princeton.edu>
This commit is contained in:
Paul Ellenbogen 2025-04-28 02:56:20 -07:00 • committed by GitHub
commit b1542a6153
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,6 +13,6 @@ async fn main() -> Result<(), Box<dyn Error>> {
let io = (tokio::io::stdin(), tokio::io::stdout());
serve_server(generic_service, io).await?;
serve_server(generic_service, io).await?.waiting().await?;
Ok(())
}