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

[tor-commits] [goptlib/master] Update setup loop examples.



commit 5a089f3f33bab6b066baad3911dc6e0d8231ce1c
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Sun Jan 12 23:29:00 2014 -0800

    Update setup loop examples.
---
 pt.go |   34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/pt.go b/pt.go
index 024eec9..181097e 100644
--- a/pt.go
+++ b/pt.go
@@ -40,13 +40,18 @@
 // 			os.Exit(1)
 // 		}
 // 		for _, methodName := range ptInfo.MethodNames {
-// 			ln, err := pt.ListenSocks("tcp", "127.0.0.1:0")
-// 			if err != nil {
-// 				pt.CmethodError(methodName, err.Error())
-// 				continue
+// 			switch methodName {
+// 			case "foo":
+// 				ln, err := pt.ListenSocks("tcp", "127.0.0.1:0")
+// 				if err != nil {
+// 					pt.CmethodError(methodName, err.Error())
+// 					break
+// 				}
+// 				go acceptLoop(ln)
+// 				pt.Cmethod(methodName, ln.Version(), ln.Addr())
+// 			default:
+// 				pt.CmethodError(methodName, "no such method")
 // 			}
-// 			go acceptLoop(ln)
-// 			pt.Cmethod(methodName, ln.Version(), ln.Addr())
 // 		}
 // 		pt.CmethodsDone()
 // 	}
@@ -86,13 +91,18 @@
 // 			os.Exit(1)
 // 		}
 // 		for _, bindaddr := range ptInfo.Bindaddrs {
-// 			ln, err := net.ListenTCP("tcp", bindaddr.Addr)
-// 			if err != nil {
-// 				pt.SmethodError(bindaddr.MethodName, err.Error())
-// 				continue
+// 			switch bindaddr.MethodName {
+// 			case "foo":
+// 				ln, err := net.ListenTCP("tcp", bindaddr.Addr)
+// 				if err != nil {
+// 					pt.SmethodError(bindaddr.MethodName, err.Error())
+// 					break
+// 				}
+// 				go acceptLoop(ln)
+// 				pt.Smethod(bindaddr.MethodName, ln.Addr())
+// 			default:
+// 				pt.SmethodError(bindaddr.MethodName, "no such method")
 // 			}
-// 			go acceptLoop(ln)
-// 			pt.Smethod(bindaddr.MethodName, ln.Addr())
 // 		}
 // 		pt.SmethodsDone()
 // 	}

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