]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Don't try to connect again without encryption, if encryption is disabled
authorMatt Joiner <anacrolix@gmail.com>
Mon, 8 Jun 2015 08:16:01 +0000 (18:16 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 8 Jun 2015 08:16:01 +0000 (18:16 +1000)
client.go

index b9b9e70ea48a41b4d41a47fad48f42f2b7eab43b..2d6bbab559f4ad0479ecf35e7b21251e4fb192f2 100644 (file)
--- a/client.go
+++ b/client.go
@@ -819,6 +819,12 @@ func (me *Client) establishOutgoingConn(t *torrent, addr string) (c *connection,
                return
        }
        nc.Close()
+       // Try again without encryption, using whichever protocol type worked last
+       // time.
+       if me.config.DisableEncryption {
+               // We already tried without encryption.
+               return
+       }
        if utp {
                nc, err = me.dialUTP(addr, t)
        } else {