tor-dam

tor distributed announce mechanism (not a dht)
git clone https://git.parazyd.org/tor-dam
Log | Files | Refs | README | LICENSE

commit 53f4dc327a13a5dc72ab93d34717dbb6d7a3d396
parent a1b6f917447996d575c6bf314144873c626f7557
Author: parazyd <parazyd@dyne.org>
Date:   Fri,  8 Dec 2017 18:05:27 +0100

Fail if we did not publish a descriptor within 90 seconds

Diffstat:
Mcmd/dam-client/main.go | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/cmd/dam-client/main.go b/cmd/dam-client/main.go @@ -9,6 +9,7 @@ import ( "log" "os" "os/exec" + "time" "github.com/parazyd/tor-dam/pkg/lib" ) @@ -48,6 +49,18 @@ func main() { scanner := bufio.NewScanner(stdout) ok := false + go func() { + // If we do not manage to publish our descriptor, we will exit. + t1 := time.Now().Unix() + for !(ok) { + t2 := time.Now().Unix() + if t2-t1 > 90 { + cmd.Process.Kill() + log.Fatalln("Too much time passed. Exiting.") + } + time.Sleep(1000 * time.Millisecond) + } + }() for !(ok) { scanner.Scan() status := scanner.Text()