|
23 | 23 | import java.util.HashMap;
|
24 | 24 | import java.util.Map;
|
25 | 25 | import java.util.Set;
|
| 26 | +import java.util.TreeMap; |
26 | 27 |
|
27 | 28 | import com.biglybt.core.config.COConfigurationManager;
|
28 | 29 | import com.biglybt.core.config.ConfigKeys;
|
|
366 | 367 |
|
367 | 368 | if ( torrent == null ){
|
368 | 369 |
|
| 370 | + /* Changed this 2025/03/12 to not create a new external torrent just for |
| 371 | + * a scrape operation, only on an announce... |
| 372 | + * |
369 | 373 | if ( !COConfigurationManager.getBooleanParameter( ConfigKeys.Tracker.BCFG_TRACKER_PUBLIC_ENABLE )){
|
370 | 374 |
|
371 | 375 | continue;
|
|
388 | 392 | continue;
|
389 | 393 | }
|
390 | 394 | }
|
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{ |
405 | 408 |
|
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; |
407 | 414 | }
|
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 | + } |
418 | 435 | }
|
| 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 ); |
419 | 448 | }
|
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 ); |
432 | 449 | }
|
433 | 450 |
|
434 | 451 | if ( hashes.length > 1 ){
|
|
0 commit comments