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

[tor-commits] [meek/master] Initialize helperAddrPattern in its declaration, not in main.



commit 7e65827d2fd1332e4d670493e860fabf0f0e06c0
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Sat Aug 2 11:49:32 2014 -0700

    Initialize helperAddrPattern in its declaration, not in main.
---
 meek-client-torbrowser/meek-client-torbrowser.go |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/meek-client-torbrowser/meek-client-torbrowser.go b/meek-client-torbrowser/meek-client-torbrowser.go
index cd23172..0c339af 100644
--- a/meek-client-torbrowser/meek-client-torbrowser.go
+++ b/meek-client-torbrowser/meek-client-torbrowser.go
@@ -43,7 +43,8 @@ import (
 	"syscall"
 )
 
-var helperAddrPattern *regexp.Regexp
+// This magic string is emitted by meek-http-helper.
+var helperAddrPattern = regexp.MustCompile(`^meek-http-helper: listen (127\.0\.0\.1:\d+)$`)
 
 func usage() {
 	fmt.Fprintf(os.Stderr, "Usage: %s [meek-client-torbrowser args] -- meek-client [meek-client args]\n", os.Args[0])
@@ -158,12 +159,6 @@ func main() {
 	sigChan := make(chan os.Signal, 1)
 	signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
 
-	// This magic string is emitted by meek-http-helper.
-	helperAddrPattern, err = regexp.Compile(`^meek-http-helper: listen (127\.0\.0\.1:\d+)$`)
-	if err != nil {
-		log.Fatal(err)
-	}
-
 	// Start firefox.
 	firefoxCmd, stdout, err := runFirefox()
 	if err != nil {

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