[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [snowflake/master] Remove SIGINT handling (no longer part of pt-spec).
commit 1fa9bc051c387b0c9bbcc16a447daaf54dfefea6
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date: Thu Jun 29 15:20:54 2017 -0700
Remove SIGINT handling (no longer part of pt-spec).
---
client/snowflake.go | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/client/snowflake.go b/client/snowflake.go
index b1c3975..ad29aea 100644
--- a/client/snowflake.go
+++ b/client/snowflake.go
@@ -198,9 +198,9 @@ func main() {
var numHandlers int = 0
var sig os.Signal
sigChan := make(chan os.Signal, 1)
- signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
+ signal.Notify(sigChan, syscall.SIGTERM)
- // wait for first signal
+ // keep track of handlers and wait for a signal
sig = nil
for sig == nil {
select {
@@ -209,17 +209,16 @@ func main() {
case sig = <-sigChan:
}
}
+
+ // signal received, shut down
for _, ln := range listeners {
ln.Close()
}
snowflakes.End()
- // wait for second signal or no more handlers
- sig = nil
- for sig == nil && numHandlers != 0 {
- select {
- case n := <-handlerChan:
- numHandlers += n
- case sig = <-sigChan:
+ for n := range handlerChan {
+ numHandlers += n
+ if numHandlers == 0 {
+ break
}
}
log.Println("snowflake is done.")
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits