[tor-commits] [goptlib/master] Nicer example, don't presume we're in a loop.

dcf at torproject.org dcf at torproject.org
Mon Dec 9 03:24:27 UTC 2013


commit a10a38f710c4467ba5f01c9509415daec8465fed
Author: David Fifield <david at bamsoftware.com>
Date:   Sun Dec 8 19:23:08 2013 -0800

    Nicer example, don't presume we're in a loop.
---
 pt.go |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pt.go b/pt.go
index 39e7471..ec2407f 100644
--- a/pt.go
+++ b/pt.go
@@ -264,14 +264,14 @@ func Smethod(name string, addr net.Addr) {
 // will be added to the server's extrainfo document.
 //
 // This is an example of how to check for a required option:
-// 	args := pt.Args{}
 // 	secret, ok := bindaddr.Options.Get("shared-secret")
-// 	if !ok {
+// 	if ok {
+// 		args := pt.Args{}
+// 		args.Add("shared-secret", secret)
+// 		pt.SmethodArgs(bindaddr.MethodName, ln.Addr(), args)
+// 	} else {
 // 		pt.SmethodError(bindaddr.MethodName, "need a shared-secret option")
-// 		continue
 // 	}
-// 	args.Add("shared-secret", secret)
-// 	pt.SmethodArgs(bindaddr.MethodName, ln.Addr(), args)
 // Or, if you just want to echo back the options provided by Tor from the
 // TransportServerOptions configuration,
 // 	pt.SmethodArgs(bindaddr.MethodName, ln.Addr(), bindaddr.Options)



More information about the tor-commits mailing list