Skip to content
Snippets Groups Projects
Unverified Commit 9b8009cf authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[feat] cleanup temp dirs on quit

parent 2bcaa8e8
No related branches found
No related tags found
No related merge requests found
package backend
import (
"log"
"os"
)
func startVPN() {
err := ctx.bm.StartVPN(ctx.Provider)
if err != nil {
log.Println(err)
os.Exit(1)
}
}
func stopVPN() {
err := ctx.bm.StopVPN()
if err != nil {
log.Println(err)
}
}
/* All the exported functions live here */
/* All the exported functions should be added here */
package backend
......@@ -24,7 +24,7 @@ func SwitchOff() {
}
func Unblock() {
//TODO
//TODO -
fmt.Println("unblock... [not implemented]")
}
......@@ -34,6 +34,7 @@ func Quit() {
ctx.cfg.SetUserStoppedVPN(true)
stopVPN()
}
cleanupTempDirs()
}
func DonateAccepted() {
......@@ -51,10 +52,7 @@ func SubscribeToEvent(event string, f unsafe.Pointer) {
func InitializeBitmaskContext() {
p := bitmask.GetConfiguredProvider()
initOnce.Do(func() {
initializeContext(
p.Provider, p.AppName)
})
initOnce.Do(func() { initializeContext(p.Provider, p.AppName) })
go ctx.updateStatus()
go func() {
......
package backend
import (
"log"
"os"
"path"
"path/filepath"
)
func cleanupTempDirs() {
dirs, _ := filepath.Glob(path.Join(os.TempDir(), "leap-*"))
for _, d := range dirs {
log.Println("removing temp dir:", d)
os.RemoveAll(d)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment