MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / stop_proxy

Method stop_proxy

src/docker/proxy_manager.rs:340–372  ·  view source on GitHub ↗

Stops and removes the specified proxy container.

(&self, container_name: &str)

Source from the content-addressed store, hash-verified

338
339 /// Stops and removes the specified proxy container.
340 pub async fn stop_proxy(&self, container_name: &str) -> Result<()> {
341 self.emit(ServerEvent::StatusMessage(format!(
342 "Stopping tsk proxy container {container_name}..."
343 )));
344
345 match self
346 .docker_client
347 .remove_container(
348 container_name,
349 Some(RemoveContainerOptions {
350 force: true,
351 ..Default::default()
352 }),
353 )
354 .await
355 {
356 Ok(_) => {
357 self.emit(ServerEvent::StatusMessage(format!(
358 "Proxy container {container_name} stopped successfully"
359 )));
360 Ok(())
361 }
362 Err(e) if e.to_lowercase().contains("no such container") => {
363 self.emit(ServerEvent::StatusMessage(format!(
364 "Proxy container {container_name} was not running"
365 )));
366 Ok(())
367 }
368 Err(e) => Err(anyhow::anyhow!(
369 "Failed to stop proxy container {container_name}: {e}"
370 )),
371 }
372 }
373
374 /// Checks if the specified proxy container is currently running.
375 pub async fn is_proxy_running(&self, container_name: &str) -> Result<bool> {

Callers 4

force_stop_proxyMethod · 0.80
test_stop_proxy_successFunction · 0.80

Calls 2

emitMethod · 0.45
remove_containerMethod · 0.45

Tested by 2

test_stop_proxy_successFunction · 0.64