prevent multiple identical shared files

pull/5/head
Zlatin Balevsky 2019-06-17 00:38:05 +01:00
parent b507361c58
commit 465171c81d
1 changed files with 13 additions and 0 deletions

View File

@ -25,4 +25,17 @@ public class SharedFile {
public int getPieceSize() {
return pieceSize;
}
@Override
public int hashCode() {
return file.hashCode() ^ infoHash.hashCode();
}
@Override
public boolean equals(Object o) {
if (!(o instanceof SharedFile))
return false;
SharedFile other = (SharedFile)o;
return file.equals(other.file) && infoHash.equals(other.infoHash);
}
}