use of com.biglybt.core.peer.PEPeerManagerListenerAdapter in project BiglyBT by BiglySoftware.
the class LightWeightSeed method activate.
protected synchronized void activate(String reason_str, byte activation_reason) {
log("Activate: " + activation_reason + "/" + reason_str);
if (activation_state != ACT_NONE) {
return;
}
try {
disk_manager = new LWSDiskManager(this, data_location);
disk_manager.start();
if (disk_manager.getState() != DiskManager.READY) {
log("Start of '" + getString() + "' failed, disk manager failed = " + disk_manager.getErrorMessage());
} else {
peer_manager = PEPeerManagerFactory.create(announcer.getPeerId(), new LWSPeerManagerAdapter(this, peer_manager_registration), disk_manager);
peer_manager.addListener(new PEPeerManagerListenerAdapter() {
@Override
public void peerAdded(final PEPeerManager manager, final PEPeer peer) {
last_activity_time = SystemTime.getMonotonousTime();
}
@Override
public void peerRemoved(PEPeerManager manager, PEPeer peer) {
last_activity_time = SystemTime.getMonotonousTime();
}
});
peer_manager.start();
announcer.update(true);
activation_state = activation_reason;
last_activity_time = SystemTime.getMonotonousTime();
}
} catch (Throwable e) {
log("Activation of '" + getString() + "' failed", e);
} finally {
if (activation_state != ACT_NONE) {
} else {
deactivate();
}
}
}
Aggregations