[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [meek/master] Exit immediately after SIGTERM is there are no signals running.



commit 1a25ac4232675e6d5efa91ad062610efc771aaaf
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Tue Mar 20 23:25:10 2018 -0700

    Exit immediately after SIGTERM is there are no signals running.
    
    The logic erroneously assumed that there was at least one handler
    running at the time a signal was received. If there was not, it would
    wait forever for something handler-related to happen.
    
    https://bugs.torproject.org/24875
---
 meek-client/meek-client.go | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/meek-client/meek-client.go b/meek-client/meek-client.go
index c2ceaf9..bbacbb4 100644
--- a/meek-client/meek-client.go
+++ b/meek-client/meek-client.go
@@ -481,11 +481,8 @@ func main() {
 	for _, ln := range listeners {
 		ln.Close()
 	}
-	for n := range handlerChan {
-		numHandlers += n
-		if numHandlers == 0 {
-			break
-		}
+	for numHandlers > 0 {
+		numHandlers += <-handlerChan
 	}
 
 	log.Printf("done")



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits