]> git.rkrishnan.org Git - functorrent.git/commitdiff
bugfix: Hash string needs to be split into 20 bytes
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Fri, 24 Jul 2015 17:32:12 +0000 (23:02 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Fri, 24 Jul 2015 17:32:12 +0000 (23:02 +0530)
Not the other way round (i.e. split by number of pieces, that' plain
wrong).

src/FuncTorrent/Peer.hs

index 62090175fc193dae18ffb39933834fd107e83c1e..b193e43633a4c34ed246fc146a41316053057d61 100644 (file)
@@ -76,7 +76,7 @@ mkPieceMap numPieces pieceHash pLengths = fromList kvs
                              , hash = h
                              , len = pLen })
               | (i, h, pLen) <- zip3 [0..numPieces] hashes pLengths]
-        hashes = splitN (fromIntegral numPieces) pieceHash
+        hashes = splitN 20 pieceHash
 
 havePiece :: PieceMap -> Integer -> Bool
 havePiece pm index =