pub mod advertise_refs; pub mod fsck; pub mod index_pack; pub mod list_packfiles; pub mod pack_objects; pub mod receive_pack; pub mod upload_pack; /// A wrapper around ReceiverStream that cancels a token when dropped. /// Used to properly clean up child processes when clients disconnect. pub struct CancellableReceiverStream { inner: tokio_stream::wrappers::ReceiverStream, _cancel_guard: tokio_util::sync::DropGuard, } impl CancellableReceiverStream { pub fn new( inner: tokio_stream::wrappers::ReceiverStream, cancel_guard: tokio_util::sync::DropGuard, ) -> Self { Self { inner, _cancel_guard: cancel_guard, } } } impl tokio_stream::Stream for CancellableReceiverStream { type Item = T; fn poll_next( mut self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>, ) -> std::task::Poll> { std::pin::Pin::new(&mut self.inner).poll_next(cx) } }