mirror of
https://github.com/anthonyraymond/joal.git
synced 2024-09-20 15:26:25 +08:00
Rename variable to match seeders and leechers
This commit is contained in:
parent
240e627a01
commit
60f19b56fe
|
@ -15,10 +15,10 @@ public interface AnnounceResponseListener extends EventListener {
|
|||
* Handle an announce response event.
|
||||
*
|
||||
* @param interval The announce interval requested by the tracker.
|
||||
* @param complete The number of seeders on this torrent.
|
||||
* @param incomplete The number of leechers on this torrent.
|
||||
* @param seeders The number of seeders on this torrent.
|
||||
* @param leechers The number of leechers on this torrent.
|
||||
*/
|
||||
void handleAnnounceResponse(final TorrentWithStats torrent, int interval, int complete, int incomplete);
|
||||
void handleAnnounceResponse(final TorrentWithStats torrent, int interval, int seeders, int leechers);
|
||||
|
||||
/**
|
||||
* Handle the discovery of new peers.
|
||||
|
|
|
@ -120,7 +120,7 @@ public class Announcer implements Runnable, AnnounceResponseListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleAnnounceResponse(final TorrentWithStats torrent, final int interval, final int complete, final int incomplete) {
|
||||
public void handleAnnounceResponse(final TorrentWithStats torrent, final int interval, final int seeders, final int leechers) {
|
||||
this.setInterval(interval);
|
||||
|
||||
if (this.stop) {
|
||||
|
@ -130,10 +130,10 @@ public class Announcer implements Runnable, AnnounceResponseListener {
|
|||
logger.info(
|
||||
"Peers discovery for torrent {}: {} leechers & {} seeders",
|
||||
torrent.getTorrent().getName(),
|
||||
incomplete,
|
||||
complete
|
||||
leechers,
|
||||
seeders
|
||||
);
|
||||
if (incomplete == 0) {
|
||||
if (leechers == 0) {
|
||||
this.eventListeners.forEach(listener -> listener.onNoMoreLeecherForTorrent(this, torrent));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,9 +140,9 @@ public abstract class TrackerClient {
|
|||
|
||||
final AnnounceResponseMessage response = (AnnounceResponseMessage) message;
|
||||
this.fireAnnounceResponseEvent(
|
||||
response.getInterval(),
|
||||
response.getComplete(),
|
||||
response.getIncomplete(),
|
||||
response.getInterval()
|
||||
response.getIncomplete()
|
||||
);
|
||||
this.fireDiscoveredPeersEvent(
|
||||
response.getPeers()
|
||||
|
@ -152,13 +152,13 @@ public abstract class TrackerClient {
|
|||
/**
|
||||
* Fire the announce response event to all listeners.
|
||||
*
|
||||
* @param complete The number of seeders on this torrent.
|
||||
* @param incomplete The number of leechers on this torrent.
|
||||
* @param seeders The number of seeders on this torrent.
|
||||
* @param leechers The number of leechers on this torrent.
|
||||
* @param interval The announce interval requested by the tracker.
|
||||
*/
|
||||
private void fireAnnounceResponseEvent(final int complete, final int incomplete, final int interval) {
|
||||
private void fireAnnounceResponseEvent( final int interval, final int seeders, final int leechers) {
|
||||
for (final AnnounceResponseListener listener : this.listeners) {
|
||||
listener.handleAnnounceResponse(this.torrent, interval, complete, incomplete);
|
||||
listener.handleAnnounceResponse(this.torrent, interval, seeders, leechers);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ public class TrackerClientTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleAnnounceResponse(final TorrentWithStats torrent, final int interval, final int complete, final int incomplete) {
|
||||
public void handleAnnounceResponse(final TorrentWithStats torrent, final int interval, final int seeders, final int leechers) {
|
||||
announceResponseCountDown.countDown();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue