Download codex-rs/code-mode/src/remote_session/connection/driver/cleanup.rs from SaylorTwift/codex: direct link, hf CLI and curl.
- Browser
- Download file 947 Bytes
-
https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/code-mode/src/remote_session/connection/driver/cleanup.rs
- Command line
-
hf download hf://SaylorTwift/codex/codex-rs/code-mode/src/remote_session/connection/driver/cleanup.rs
-
curl -L -o cleanup.rs https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/code-mode/src/remote_session/connection/driver/cleanup.rs
947 Bytes
| use std::sync::Arc; | |
| use tokio_util::sync::CancellationToken; | |
| use super::notify_cell_closed; | |
| use super::session_registry::CellOwner; | |
| struct CleanupInner { | |
| complete: CancellationToken, | |
| } | |
| pub(in crate::remote_session) struct SessionCleanup { | |
| inner: Arc<CleanupInner>, | |
| } | |
| impl SessionCleanup { | |
| pub(in crate::remote_session) fn new() -> Self { | |
| Self { | |
| inner: Arc::new(CleanupInner { | |
| complete: CancellationToken::new(), | |
| }), | |
| } | |
| } | |
| pub(super) fn fail(&self, cells: Vec<CellOwner>) { | |
| for owner in cells { | |
| notify_cell_closed(&owner.delegate, &owner.cell_id); | |
| } | |
| self.inner.complete.cancel(); | |
| } | |
| pub(in crate::remote_session) async fn wait(&self) { | |
| self.inner.complete.cancelled().await; | |
| } | |
| pub(in crate::remote_session) fn is_complete(&self) -> bool { | |
| self.inner.complete.is_cancelled() | |
| } | |
| } | |