]> Cypherpunks.ru repositories - govpn.git/commitdiff
Execute all down script when server is terminated
authorSergey Matveev <stargrave@stargrave.org>
Mon, 7 Mar 2016 12:02:35 +0000 (15:02 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 7 Mar 2016 12:08:50 +0000 (15:08 +0300)
src/cypherpunks.ru/govpn/cmd/govpn-server/main.go

index 0c385c74436a77af75672c155d4a9cdf66fb6663..5cddab87cea5d85efa7cb33bfb8109706a9ed995 100644 (file)
@@ -89,6 +89,14 @@ MainCycle:
        for {
                select {
                case <-termSignal:
+                       log.Println("Terminating")
+                       for _, ps := range peers {
+                               govpn.ScriptCall(
+                                       confs[*ps.peer.Id].Down,
+                                       ps.tap.Name,
+                                       ps.peer.Addr,
+                               )
+                       }
                        break MainCycle
                case <-hsHeartbeat:
                        now := time.Now()