Rename variable to match seeders and leechers

This commit is contained in:
anthonyraymond 2017-06-08 22:50:38 +02:00
parent 240e627a01
commit 60f19b56fe
4 changed files with 14 additions and 14 deletions

View file

@ -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.

View file

@ -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));
}
}

View file

@ -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);
}
}

View file

@ -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();
}