From 0554bfa9a1ee2a7c9d3ff24749317fd9b3202ca2 Mon Sep 17 00:00:00 2001 From: maride Date: Sat, 8 Sep 2018 00:28:34 +0200 Subject: Stop all challenge containers on shutdown --- src/containerManager.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/containerManager.go') diff --git a/src/containerManager.go b/src/containerManager.go index 0c25ae9..c8af5f9 100644 --- a/src/containerManager.go +++ b/src/containerManager.go @@ -62,6 +62,16 @@ func stopChallengeContainer(name string) { } } +// Stops all containers. Thread-safe! +func stopAllChallengeContainers() { + containerStopLock.Lock() + defer containerStopLock.Unlock() + + for _, c := range containers { + c.stopContainer() + } +} + // Returns the address for the given container, if there is a container with this name running func getAddressForChallengeContainer(container string) (address string) { for _, c := range containers { -- cgit 1.4.1