Add ClientNotifier

This commit is contained in:
anthonyraymond 2018-01-02 23:49:29 +01:00
parent c16f321382
commit d3b119d62f
2 changed files with 52 additions and 0 deletions

View file

@ -27,6 +27,10 @@ public class Client implements TorrentFileChangeAware {
this.currentlySeedingTorrents = new ArrayList<>();
}
public void onSeedSlotIsAvailable() {
// TODO: add a new torrent
}
@Override
public void onTorrentFileAdded(final MockedTorrent torrent) {

View file

@ -0,0 +1,48 @@
package org.araymond.joal.core.ttorrent.client.announcer.response;
import org.araymond.joal.core.ttorrent.client.Client;
import org.araymond.joal.core.ttorrent.client.announcer.exceptions.TooMuchAnnouncesFailedInARawException;
import org.araymond.joal.core.ttorrent.client.announcer.request.Announcer;
import org.araymond.joal.core.ttorrent.client.announcer.request.SuccessAnnounceResponse;
public class ClientNotifier implements AnnounceResponseHandlerChainElement {
private Client client;
private void setClient(final Client client) {
this.client = client;
}
@Override
public void onAnnouncerWillAnnounce(final Announcer announcer) {
}
@Override
public void onAnnounceStartSuccess(final Announcer announcer, final SuccessAnnounceResponse result) {
}
@Override
public void onAnnounceStartFails(final Announcer announcer, final Throwable throwable) {
}
@Override
public void onAnnounceRegularSuccess(final Announcer announcer, final SuccessAnnounceResponse result) {
}
@Override
public void onAnnounceRegularFails(final Announcer announcer, final Throwable throwable) {
}
@Override
public void onAnnounceStopSuccess(final Announcer announcer, final SuccessAnnounceResponse result) {
this.client.onSeedSlotIsAvailable();
}
@Override
public void onAnnounceStopFails(final Announcer announcer, final Throwable throwable) {
}
@Override
public void onTooManyAnnounceFailedInARaw(final Announcer announcer, final TooMuchAnnouncesFailedInARawException e) {
this.client.onSeedSlotIsAvailable();
}
}