Incorrect SocksListener temporary error check

You can see the code in question -- in acceptLoop() -- here: https://gitweb.torproject.org/pluggable-transports/meek.git/tree/meek-client/meek-client.go#n300

The existing code will treat an error that is not a net.Error as temporary, which is the reverse of how it should be. See the diff to fix it below.

Note that it is highly unlikely (impossible?) that the existing code would have caused an actual problem.

(The code in question is probably based on the example in the goptlib code. I have also submitted a pull request to fix that example.)

diff --git a/meek-client/meek-client.go b/meek-client/meek-client.go
index 280ab1b..bb6c0b1 100644
--- a/meek-client/meek-client.go
+++ b/meek-client/meek-client.go
@@ -303,10 +303,11 @@ func acceptLoop(ln *pt.SocksListener) error {
                conn, err := ln.AcceptSocks()
                if err != nil {
                        log.Printf("error in AcceptSocks: %s", err)
-                       if e, ok := err.(net.Error); ok && !e.Temporary() {
-                               return err
+                       if e, ok := err.(net.Error); ok && e.Temporary() {
+
+                               continue
                        }
-                       continue
+                       return err
                }
                go func() {
                        err := handler(conn)

Trac:
Username: adam-p

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information