public void tick() { peersManager.tick(); choker.tick(); Long waitTime = activeTracker.getInterval(); if (incomingPeerListener.getReceivedConnection() == 0 || peersManager.getActivePeersNumber() < 4) { waitTime = activeTracker.getMinInterval() != null ? activeTracker.getMinInterval() : 60; } long now = System.currentTimeMillis(); if (now - activeTracker.getLastRequestTime() >= waitTime * 1000) { if (!stopped) { try { Object peers = trackerRequest(null).get(ByteBuffer.wrap("peers".getBytes())); if (peers != null) { addPeers(peers); } } catch (Exception e) { e.printStackTrace(); } } } }
public void interrupted(Peer peer) { choker.interrupted(peer); pieceChooser.interrupted(peer); }
public void interested(Peer peer) { choker.interested(peer); }
public void notInterested(Peer peer) { choker.notInterested(peer); }
public void unchoke(Peer peer) { /* remove all the pending request */ pieceChooser.interrupted(peer); choker.unchoke(peer); addRequests(peer); }