refactor(controller): use state to find available port range

This commit is contained in:
hdbg
2025-12-08 14:32:08 +01:00
parent 570cec8b47
commit 471f9129b4
3 changed files with 11 additions and 5 deletions

View File

@@ -88,8 +88,8 @@ impl StateManager {
self.0.borrow_mut().instances.insert(project_name, state);
}
pub fn remove(&self, project_name: &str) -> Option<InstanceState> {
self.0.borrow_mut().instances.remove(project_name)
pub fn get_highest_used_port(&self) -> Option<u16> {
self.0.borrow().instances.values().map(|i| i.port).max()
}
}