Disable PEX/metadata extensions and open trackers for private torrents

Handle announce URLs with parameters correctly
This commit is contained in:
zzz
2012-02-18 17:58:54 +00:00
parent c957577e72
commit 295242316b
5 changed files with 49 additions and 24 deletions

View File

@@ -489,6 +489,13 @@ class PeerState implements DataLoader
/** @since 0.8.2 */
void extensionMessage(int id, byte[] bs)
{
if (metainfo != null && metainfo.isPrivate() &&
(id == ExtensionHandler.ID_METADATA || id == ExtensionHandler.ID_PEX)) {
// shouldn't get this since we didn't advertise it but they could send it anyway
if (_log.shouldLog(Log.WARN))
_log.warn("Private torrent, ignoring ext msg " + id);
return;
}
ExtensionHandler.handleMessage(peer, listener, id, bs);
// Peer coord will get metadata from MagnetState,
// verify, and then call gotMetaInfo()