about summary refs log tree commit diff
path: root/src/containerManager.go
diff options
context:
space:
mode:
authormaride <maride@darknebu.la>2018-09-08 00:28:34 +0200
committermaride <maride@darknebu.la>2018-09-08 00:28:34 +0200
commit0554bfa9a1ee2a7c9d3ff24749317fd9b3202ca2 (patch)
tree53c236b4595d912260603465c874134413d11bb2 /src/containerManager.go
parent5dde5e766c0178a80416e3ec8f3ffc55a2691ed2 (diff)
Stop all challenge containers on shutdown
Diffstat (limited to 'src/containerManager.go')
-rw-r--r--src/containerManager.go10
1 files changed, 10 insertions, 0 deletions
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 {