Methods Summary |
---|
public void | addConnectedPeer(PeerItem peer)Add peer info obtained via peer exchange.
try{ peers_mon.enter();
if( !maintain_peers_state ) return;
int max_cache_size = PeerUtils.MAX_CONNECTIONS_PER_TORRENT;
if( max_cache_size < 1 || max_cache_size > MAX_KNOWN_PER_PEER ) max_cache_size = MAX_KNOWN_PER_PEER;
if( connected_peers.size() < max_cache_size ) {
connected_peers.put( peer, null );
}
}
finally{ peers_mon.exit(); }
|
public void | destroy()
parent_db.deregisterPeerConnection( base_peer );
try{ peers_mon.enter();
connections_added.clear();
connections_dropped.clear();
connected_peers.clear();
}
finally{ peers_mon.exit(); }
|
public void | disableStateMaintenance()Clears all current peer state records and stops any future state maintenance.
try{ peers_mon.enter();
maintain_peers_state = false;
connections_added.clear();
connections_dropped.clear();
connected_peers.clear();
}
finally{ peers_mon.exit(); }
|
public void | dropConnectedPeer(PeerItem peer)Remove peer info obtained via peer exchange.
try{ peers_mon.enter();
connected_peers.remove( peer );
}
finally{ peers_mon.exit(); }
|
protected PeerItem | getBasePeer() return base_peer;
|
protected PeerItem[] | getConnectedPeers()
try{ peers_mon.enter();
PeerItem[] peers = new PeerItem[ connected_peers.size() ];
connected_peers.keySet().toArray( peers );
return peers;
}
finally{ peers_mon.exit(); }
|
protected com.aelitis.azureus.core.peermanager.peerdb.PeerExchangerItem$Helper | getHelper() return helper;
|
public PeerItem[] | getNewlyAddedPeerConnections()Get the list of peer connections added since this method was last called.
try{ peers_mon.enter();
if( connections_added.isEmpty() ) return null;
int num_to_send = connections_added.size() > MAX_PEERS_PER_VOLLEY ? MAX_PEERS_PER_VOLLEY : connections_added.size();
PeerItem[] peers = new PeerItem[ num_to_send ];
for( int i=0; i < num_to_send; i++ ) {
peers[i] = (PeerItem)connections_added.removeFirst();
}
return peers;
}
finally{ peers_mon.exit(); }
|
public PeerItem[] | getNewlyDroppedPeerConnections()Get the list of peer connections dropped since this method was last called.
try{ peers_mon.enter();
if( connections_dropped.isEmpty() ) return null;
int num_to_send = connections_dropped.size() > MAX_PEERS_PER_VOLLEY ? MAX_PEERS_PER_VOLLEY : connections_dropped.size();
PeerItem[] peers = new PeerItem[ num_to_send ];
for( int i=0; i < num_to_send; i++ ) {
peers[i] = (PeerItem)connections_dropped.removeFirst();
}
return peers;
}
finally{ peers_mon.exit(); }
|
protected boolean | isConnectedToPeer(PeerItem peer)
try{ peers_mon.enter();
return connected_peers.containsKey( peer );
}
finally{ peers_mon.exit(); }
|
protected void | notifyAdded(PeerItem peer_connection)
try{ peers_mon.enter();
if( !maintain_peers_state ) return;
if( !connections_dropped.contains( peer_connection ) ) {
if( !connections_added.contains( peer_connection ) ) {
connections_added.addLast( peer_connection ); //register new add
}
}
else { //was dropped and then re-added
connections_dropped.remove( peer_connection ); //pull drop and ignore add
}
}
finally{ peers_mon.exit(); }
|
protected void | notifyDropped(PeerItem peer_connection)
try{ peers_mon.enter();
if( !maintain_peers_state ) return;
if( !connections_added.contains( peer_connection ) ) {
if( !connections_dropped.contains( peer_connection ) ) {
connections_dropped.addLast( peer_connection ); //register new drop
}
}
else { //was added and then re-dropped
connections_added.remove( peer_connection ); //pull add and ignore drop
}
}
finally{ peers_mon.exit(); }
|
public void | seedStatusChanged()
parent_db.seedStatusChanged( this );
|