torrent.go | 6 +++++- diff --git a/torrent.go b/torrent.go index 7257bb30d83df6bc7033055018d15a78ee052c59..178f29aed56d0474bb4e7a42915419ec559d95bf 100644 --- a/torrent.go +++ b/torrent.go @@ -91,7 +91,11 @@ return (len(t.MetaData) + (1 << 14) - 1) / (1 << 14) } func (t *torrent) HaveMetadataPiece(piece int) bool { - return t.haveInfo() || t.metadataHave[piece] + if t.haveInfo() { + return (1<<14)*piece < len(t.MetaData) + } else { + return t.metadataHave[piece] + } } func (t *torrent) metadataSizeKnown() bool {