From 90355b3dc7943a17c3a9f7e34154d87d8192a119 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Fri, 19 Jul 2019 13:07:40 +1000 Subject: [PATCH] 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. --- client.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 -- 2.48.1