From: Matt Joiner Date: Fri, 19 Jul 2019 03:07:40 +0000 (+1000) Subject: Add dummy code for emulating the bug in #114 X-Git-Tag: v1.5.0~13 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=90355b3dc7943a17c3a9f7e34154d87d8192a119;p=btrtrc.git Add dummy code for emulating the bug in #114 Useful for ensuring that the test can still reproduce the issue with changes to encryption handling. --- diff --git a/client.go b/client.go index 8180c14b..fbf05d7e 100644 --- a/client.go +++ b/client.go @@ -742,6 +742,19 @@ func (cl *Client) initiateHandshakes(c *connection, t *Torrent) (ok bool, err er func (cl *Client) forSkeys(f func([]byte) bool) { cl.lock() defer cl.unlock() + if false { // Emulate the bug from #114 + var firstIh InfoHash + for ih := range cl.torrents { + firstIh = ih + break + } + for range cl.torrents { + if !f(firstIh[:]) { + break + } + } + return + } for ih := range cl.torrents { if !f(ih[:]) { break