tordam

A library for peer discovery inside the Tor network
git clone https://git.parazyd.org/tordam
Log | Files | Refs | README | LICENSE

commit 49372b5d4c62690ea9d63f568f3b28596e5a8e86
parent 43be00486d49717117eb9afefb875b149b579628
Author: parazyd <parazyd@dyne.org>
Date:   Thu,  1 Nov 2018 13:43:01 +0100

Defer and kill damhs.py and redis when exiting.

Diffstat:
Mcmd/dam-client/main.go | 3+--
Mcmd/dam-dir/main.go | 3++-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cmd/dam-client/main.go b/cmd/dam-client/main.go @@ -258,6 +258,7 @@ func main() { log.Println("Starting up the hidden service.") cmd := exec.Command("damhs.py", lib.PrivKeyPath, lib.TorPortMap) + defer cmd.Process.Kill() stdout, err := cmd.StdoutPipe() lib.CheckError(err) @@ -272,8 +273,6 @@ func main() { for !(ok) { t2 := time.Now().Unix() if t2-t1 > 90 { - err := cmd.Process.Kill() - lib.CheckError(err) log.Fatalln("Too much time has passed for publishing descriptor.") } time.Sleep(1000 * time.Millisecond) diff --git a/cmd/dam-dir/main.go b/cmd/dam-dir/main.go @@ -239,7 +239,8 @@ func main() { if _, err := lib.RedisCli.Ping().Result(); err != nil { // We assume redis is not running. Start it up. - _, err := lib.StartRedis(redconf) + cmd, err := lib.StartRedis(redconf) + defer cmd.Process.Kill() lib.CheckError(err) }