MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / remove_rule

Method remove_rule

port-forward/src/lib.rs:92–107  ·  view source on GitHub ↗

Remove a forwarding rule and stop its task.

(&mut self, rule: &ForwardRule)

Source from the content-addressed store, hash-verified

90
91 /// Remove a forwarding rule and stop its task.
92 pub async fn remove_rule(&mut self, rule: &ForwardRule) -> Result<()> {
93 match self.rules.remove(rule) {
94 Some(running) => {
95 running.cancel.cancel();
96 let _ = running.task.await;
97 tracing::info!(
98 "removed forwarding rule: {} -> {} ({:?})",
99 rule.listen_sock(),
100 rule.target_sock(),
101 rule.protocol,
102 );
103 Ok(())
104 }
105 None => bail!("rule not found: {:?}", rule),
106 }
107 }
108
109 /// Number of active rules.
110 pub fn len(&self) -> usize {

Callers 2

cleanup_port_forwardMethod · 0.80

Calls 1

removeMethod · 0.45

Tested by

no test coverage detected