[tor-commits] [snowflake/master] Simplify a conditional.

dcf at torproject.org dcf at torproject.org
Wed Feb 5 05:36:26 UTC 2020


commit ca9ae12c383405bc9a755e1bc902e9755495c1f1
Author: David Fifield <david at bamsoftware.com>
Date:   Tue Feb 4 22:35:12 2020 -0700

    Simplify a conditional.
---
 server/server.go | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/server/server.go b/server/server.go
index 85bf4f5..c484a19 100644
--- a/server/server.go
+++ b/server/server.go
@@ -111,11 +111,7 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 	// Pass the address of client as the remote address of incoming connection
 	clientIPParam := r.URL.Query().Get("client_ip")
 	addr := clientAddr(clientIPParam)
-	if addr == "" {
-		statsChannel <- false
-	} else {
-		statsChannel <- true
-	}
+	statsChannel <- addr != ""
 	or, err := pt.DialOr(&ptInfo, addr, ptMethodName)
 	if err != nil {
 		log.Printf("failed to connect to ORPort: %s", err)



More information about the tor-commits mailing list