mirror of
https://github.com/anthonyraymond/joal.git
synced 2024-09-20 15:26:25 +08:00
Add ClientNotifier
This commit is contained in:
parent
c16f321382
commit
d3b119d62f
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue