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

[tor-commits] [meek/webextension] Look for EOF on stdin while grepping for the helper address.



commit 01ea27b4c59cd8ae17e608006cd7a9a16ba282c4
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Sat Feb 23 00:23:51 2019 -0700

    Look for EOF on stdin while grepping for the helper address.
    
    This way, we still exit when the parent process dies, even if for
    whatever reason Firefox doesn't give us a helper address.
    
    https://bugs.torproject.org/29559
---
 meek-client-torbrowser/meek-client-torbrowser.go | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/meek-client-torbrowser/meek-client-torbrowser.go b/meek-client-torbrowser/meek-client-torbrowser.go
index f3ffc68..16f0ebc 100644
--- a/meek-client-torbrowser/meek-client-torbrowser.go
+++ b/meek-client-torbrowser/meek-client-torbrowser.go
@@ -370,10 +370,25 @@ func main() {
 	defer logKill(firefoxCmd.Process)
 
 	// Find out the helper's listening address.
-	helperAddr, err := grepHelperAddr(stdout)
-	if err != nil {
+	addrChan := make(chan string)
+	errChan := make(chan error)
+	go func() {
+		addr, err := grepHelperAddr(stdout)
+		if err == nil {
+			addrChan <- addr
+		} else {
+			errChan <- err
+		}
+	}()
+	var helperAddr string
+	select {
+	case sig := <-sigChan:
+		log.Printf("sig %s", sig)
+		return
+	case err = <-errChan:
 		log.Print(err)
 		return
+	case helperAddr = <-addrChan:
 	}
 
 	// Start meek-client with the helper address.



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