Disconnect seeds that connect to a seed

This commit is contained in:
zzz
2010-04-10 15:26:23 +00:00
parent e3c222b5c1
commit 89d0d7b266

View File

@ -152,7 +152,16 @@ class PeerState
// XXX - Check for weird bitfield and disconnect? // XXX - Check for weird bitfield and disconnect?
bitfield = new BitField(bitmap, metainfo.getPieces()); bitfield = new BitField(bitmap, metainfo.getPieces());
} }
setInteresting(listener.gotBitField(peer, bitfield)); boolean interest = listener.gotBitField(peer, bitfield);
setInteresting(interest);
if (bitfield.complete() && !interest) {
// They are seeding and we are seeding,
// why did they contact us? (robert)
// Dump them quick before we send our whole bitmap
if (_log.shouldLog(Log.WARN))
_log.warn("Disconnecting seed that connects to seeds" + peer);
peer.disconnect(true);
}
} }
void requestMessage(int piece, int begin, int length) void requestMessage(int piece, int begin, int length)