Skip to content

Commit d1b749c

Browse files
committed
Don't create external torrent entries when only scraped
1 parent fb0861a commit d1b749c

File tree

1 file changed

+54
-37
lines changed

1 file changed

+54
-37
lines changed

core/src/com/biglybt/core/tracker/server/impl/TRTrackerServerProcessor.java

+54-37
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.HashMap;
2424
import java.util.Map;
2525
import java.util.Set;
26+
import java.util.TreeMap;
2627

2728
import com.biglybt.core.config.COConfigurationManager;
2829
import com.biglybt.core.config.ConfigKeys;
@@ -366,6 +367,9 @@
366367

367368
if ( torrent == null ){
368369

370+
/* Changed this 2025/03/12 to not create a new external torrent just for
371+
* a scrape operation, only on an announce...
372+
*
369373
if ( !COConfigurationManager.getBooleanParameter( ConfigKeys.Tracker.BCFG_TRACKER_PUBLIC_ENABLE )){
370374
371375
continue;
@@ -388,47 +392,60 @@
388392
continue;
389393
}
390394
}
391-
}
392-
393-
long interval = server.getScrapeRetryInterval( torrent );
394-
395-
if ( interval > max_interval ){
396-
397-
max_interval = interval;
398-
}
399-
400-
if ( scrape_chars != null && ( QUEUE_TEST || !( loopback || ip_override ))){
401-
402-
// note, 'Q' is complete+queued so we set seed true below
403-
404-
if ( scrape_chars[i] == 'Q' ){
395+
*/
396+
397+
// dummy entry
398+
399+
Map<String, Object> hash_entry = new TreeMap<>();
400+
401+
hash_entry.put( "complete", new Long( 0 ));
402+
hash_entry.put( "incomplete", new Long( 0 ));
403+
hash_entry.put( "downloaded", new Long(0 ));
404+
405+
files.put( str_hash, hash_entry );
406+
407+
}else{
405408

406-
torrent.peerQueued( client_ip_address, port, udp_port, http_port, crypto_level, az_ver, (int)interval, true );
409+
long interval = server.getScrapeRetryInterval( torrent );
410+
411+
if ( interval > max_interval ){
412+
413+
max_interval = interval;
407414
}
408-
}
409-
410-
if ( torrent.getRedirects() != null ){
411-
412-
if ( hashes.length > 1 ){
413-
414-
// just drop this from the set. this will cause the client to revert
415-
// to single-hash scrapes and subsequently pick up the redirect
416-
417-
continue;
415+
416+
if ( scrape_chars != null && ( QUEUE_TEST || !( loopback || ip_override ))){
417+
418+
// note, 'Q' is complete+queued so we set seed true below
419+
420+
if ( scrape_chars[i] == 'Q' ){
421+
422+
torrent.peerQueued( client_ip_address, port, udp_port, http_port, crypto_level, az_ver, (int)interval, true );
423+
}
424+
}
425+
426+
if ( torrent.getRedirects() != null ){
427+
428+
if ( hashes.length > 1 ){
429+
430+
// just drop this from the set. this will cause the client to revert
431+
// to single-hash scrapes and subsequently pick up the redirect
432+
433+
continue;
434+
}
418435
}
436+
437+
server.preProcess( new lightweightPeer(client_ip_address,port,peer_id), torrent, request_type, request, null );
438+
439+
// we don't cache local scrapes as if we do this causes the hosting of
440+
// torrents to retrieve old values initially. Not a fatal error but not
441+
// the best behaviour as the (local) seed isn't initially visible.
442+
443+
Map hash_entry = torrent.exportScrapeToMap( request, client_ip_address, !local_scrape );
444+
445+
// System.out.println( "tracker - encoding: " + ByteFormatter.nicePrint(torrent_hash) + " -> " + ByteFormatter.nicePrint( str_hash.getBytes( Constants.BYTE_ENCODING )));
446+
447+
files.put( str_hash, hash_entry );
419448
}
420-
421-
server.preProcess( new lightweightPeer(client_ip_address,port,peer_id), torrent, request_type, request, null );
422-
423-
// we don't cache local scrapes as if we do this causes the hosting of
424-
// torrents to retrieve old values initially. Not a fatal error but not
425-
// the best behaviour as the (local) seed isn't initially visible.
426-
427-
Map hash_entry = torrent.exportScrapeToMap( request, client_ip_address, !local_scrape );
428-
429-
// System.out.println( "tracker - encoding: " + ByteFormatter.nicePrint(torrent_hash) + " -> " + ByteFormatter.nicePrint( str_hash.getBytes( Constants.BYTE_ENCODING )));
430-
431-
files.put( str_hash, hash_entry );
432449
}
433450

434451
if ( hashes.length > 1 ){

0 commit comments

Comments
 (0)