about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/containerManager.go10
-rw-r--r--src/main.go3
2 files changed, 12 insertions, 1 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 {
diff --git a/src/main.go b/src/main.go
index 4833896..574d156 100644
--- a/src/main.go
+++ b/src/main.go
@@ -55,9 +55,10 @@ func cleanup(signalChannel chan os.Signal, server http.Server) {
 	server.Close()
 	log.Println("Stopping VPN container")
 	stopVPN()
+	log.Println("Stopping challenge containers")
+	stopAllChallengeContainers()
 	log.Println("Deleting Docker networks")
 	deleteNetwork(vpnHostNetworkName)
 	deleteNetwork(containerNetworkName)
-	// TODO: stop challenge containers
 	os.Exit(0)
 }