]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix panic in benchmark
authorMatt Joiner <anacrolix@gmail.com>
Wed, 27 Oct 2021 02:57:19 +0000 (13:57 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Wed, 27 Oct 2021 02:57:19 +0000 (13:57 +1100)
peerconn_test.go

index b6ad410c103a855eb329c11381be0757f062c22e..93bc7aa565c2523dedfd734b239e70889502f64b 100644 (file)
@@ -98,12 +98,12 @@ func BenchmarkConnectionMainReadLoop(b *testing.B) {
                storage:           &storage.Torrent{TorrentImpl: storage.TorrentImpl{Piece: ts.Piece, Close: ts.Close}},
                pieceStateChanges: pubsub.NewPubSub(),
        }
+       t.setChunkSize(defaultChunkSize)
        require.NoError(b, t.setInfo(&metainfo.Info{
                Pieces:      make([]byte, 20),
                Length:      1 << 20,
                PieceLength: 1 << 20,
        }))
-       t.setChunkSize(defaultChunkSize)
        t._pendingPieces.Add(0)
        r, w := net.Pipe()
        cn := cl.newConnection(r, true, r.RemoteAddr(), r.RemoteAddr().Network(), regularNetConnPeerConnConnString(r))