]> Sergey Matveev's repositories - btrtrc.git/blobdiff - connection_test.go
Add Torrent.setInfo
[btrtrc.git] / connection_test.go
index f22d26b9ba5727a16c23361a7b60aff068bb70ab..d3c299b0e0a99338367851dedac69cac5c258c83 100644 (file)
@@ -86,17 +86,16 @@ func BenchmarkConnectionMainReadLoop(b *testing.B) {
        cl := &Client{}
        ts := &torrentStorage{}
        t := &Torrent{
-               cl: cl,
-               info: &metainfo.Info{
-                       Pieces:      make([]byte, 20),
-                       Length:      1 << 20,
-                       PieceLength: 1 << 20,
-               },
+               cl:                cl,
                storage:           &storage.Torrent{ts},
                pieceStateChanges: pubsub.NewPubSub(),
        }
+       require.NoError(b, t.setInfo(&metainfo.Info{
+               Pieces:      make([]byte, 20),
+               Length:      1 << 20,
+               PieceLength: 1 << 20,
+       }))
        t.setChunkSize(defaultChunkSize)
-       t.makePieces()
        t.pendingPieces.Set(0, PiecePriorityNormal.BitmapPriority())
        r, w := io.Pipe()
        cn := &connection{