[tor-commits] [snowflake/master] Remove a level of indentation in server.

dcf at torproject.org dcf at torproject.org
Fri Jan 20 18:21:46 UTC 2017


commit 8378f8595214449cc3fd1db44f5463b72d237836
Author: David Fifield <david at bamsoftware.com>
Date:   Fri Jan 20 10:19:25 2017 -0800

    Remove a level of indentation in server.
---
 server/server.go | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/server/server.go b/server/server.go
index b2876fa..9bfe9e9 100644
--- a/server/server.go
+++ b/server/server.go
@@ -256,26 +256,26 @@ func main() {
 
 	listeners := make([]net.Listener, 0)
 	for _, bindaddr := range ptInfo.Bindaddrs {
-		switch bindaddr.MethodName {
-		case ptMethodName:
-			var ln net.Listener
-			args := pt.Args{}
-			if disableTLS {
-				args.Add("tls", "no")
-				ln, err = startListener("tcp", bindaddr.Addr)
-			} else {
-				args.Add("tls", "yes")
-				ln, err = startListenerTLS("tcp", bindaddr.Addr, certFilename, keyFilename)
-			}
-			if err != nil {
-				pt.SmethodError(bindaddr.MethodName, err.Error())
-				break
-			}
-			pt.SmethodArgs(bindaddr.MethodName, ln.Addr(), args)
-			listeners = append(listeners, ln)
-		default:
+		if bindaddr.MethodName != ptMethodName {
 			pt.SmethodError(bindaddr.MethodName, "no such method")
+			continue
 		}
+
+		var ln net.Listener
+		args := pt.Args{}
+		if disableTLS {
+			args.Add("tls", "no")
+			ln, err = startListener("tcp", bindaddr.Addr)
+		} else {
+			args.Add("tls", "yes")
+			ln, err = startListenerTLS("tcp", bindaddr.Addr, certFilename, keyFilename)
+		}
+		if err != nil {
+			pt.SmethodError(bindaddr.MethodName, err.Error())
+			break
+		}
+		pt.SmethodArgs(bindaddr.MethodName, ln.Addr(), args)
+		listeners = append(listeners, ln)
 	}
 	pt.SmethodsDone()
 



More information about the tor-commits mailing list