Methods Summary |
---|
public void | addListener(PeerListener l)
PEPeerListener core_listener =
new PEPeerListener()
{
public void
stateChanged(
final PEPeer peer, // seems don't need this here
int new_state )
{
try{
l.stateChanged( new_state );
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
public void
sentBadChunk(
final PEPeer peer, // seems don't need this here
int piece_num,
int total_bad_chunks )
{
try{
l.sentBadChunk( piece_num, total_bad_chunks );
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
public void addAvailability(final PEPeer peer, BitFlags peerHavePieces)
{
}
public void removeAvailability(final PEPeer peer, BitFlags peerHavePieces)
{
}
};
delegate.addListener( core_listener );
if( peer_listeners == null ){
peer_listeners = new HashMap();
}
peer_listeners.put( l, core_listener );
|
public void | addListener(PeerListener2 l)
PEPeerListener core_listener =
new PEPeerListener()
{
public void
stateChanged(
final PEPeer peer, // seems don't need this here
int new_state )
{
fireEvent( PeerEvent.ET_STATE_CHANGED, new Integer( new_state ));
}
public void
sentBadChunk(
final PEPeer peer, // seems don't need this here
int piece_num,
int total_bad_chunks )
{
fireEvent( PeerEvent.ET_BAD_CHUNK, new Integer[]{ new Integer(piece_num), new Integer(total_bad_chunks)});
}
public void addAvailability(final PEPeer peer, BitFlags peerHavePieces)
{
fireEvent( PeerEvent.ET_ADD_AVAILABILITY,peerHavePieces.flags );
}
public void removeAvailability(final PEPeer peer, BitFlags peerHavePieces)
{
fireEvent( PeerEvent.ET_REMOVE_AVAILABILITY,peerHavePieces.flags );
}
protected void
fireEvent(
final int type,
final Object data )
{
try{
l.eventOccurred(
new PeerEvent()
{
public int getType(){ return( type );}
public Object getData(){ return( data );}
});
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
};
delegate.addListener( core_listener );
if( peer_listeners == null ){
peer_listeners = new HashMap();
}
peer_listeners.put( l, core_listener );
|
public boolean | addRequest(PeerReadRequest request)
throw( new RuntimeException( "not supported"));
|
public void | cancelRequest(PeerReadRequest request)
throw( new RuntimeException( "not supported"));
|
public void | close(java.lang.String reason, boolean closedOnError, boolean attemptReconnect)
manager.removePeer( this, reason );
|
protected void | closed()
if ( delegate instanceof PeerForeignDelegate ){
((PeerForeignDelegate)delegate).stop();
}
|
public boolean | equals(java.lang.Object other)
if ( other instanceof PeerImpl ){
return( delegate == ((PeerImpl)other).delegate );
}
return( false );
|
public final boolean[] | getAvailable()
return( delegate.getAvailable().flags );
|
public java.lang.String | getClient()
return( delegate.getClient());
|
public org.gudy.azureus2.plugins.network.Connection | getConnection()
return delegate.getPluginConnection();
|
protected PEPeer | getDelegate()
return( delegate );
|
public java.util.List | getExpiredRequests()
throw( new RuntimeException( "not supported"));
|
public byte[] | getHandshakeReservedBytes()
return delegate.getHandshakeReservedBytes();
|
public byte[] | getId()
// we *really* don't want a plugin to accidentally change our peerid (e.g. the Stuffer plugin did this)
// as this screws stuff up bigtime
byte[] id = delegate.getId();
if ( id == null ){
return( null );
}
byte[] copy = new byte[id.length];
System.arraycopy( id, 0, copy, 0, copy.length );
return( copy );
|
public java.lang.String | getIp()
return( delegate.getIp());
|
public PeerManager | getManager()
return( manager );
|
public int | getMaximumNumberOfRequests()
throw( new RuntimeException( "not supported"));
|
public int | getNumberOfRequests()
throw( new RuntimeException( "not supported"));
|
public PEPeer | getPEPeer()Core use only. This is not propogated to the plugin interface
return delegate;
|
public int | getPercentDone()
return( delegate.getPercentDoneInThousandNotation());
|
public int | getPercentDoneInThousandNotation()
return( delegate.getPercentDoneInThousandNotation());
|
public int | getPercentDoneOfCurrentIncomingRequest()
return( delegate.getPercentDoneOfCurrentIncomingRequest());
|
public int | getPercentDoneOfCurrentOutgoingRequest()
return( delegate.getPercentDoneOfCurrentOutgoingRequest());
|
public int | getPort()
return( delegate.getPort());
|
public int[] | getPriorityOffsets()
throw( new RuntimeException( "not supported"));
|
public java.util.Map | getProperties()
return( new HashMap());
|
public java.lang.Object[] | getQueryableInterfaces()
return new Object[] { delegate };
|
public java.lang.String | getRelationText()
return propogatedRelationText(delegate);
|
public java.util.List | getRequests()
throw( new RuntimeException( "not supported"));
|
public long | getSnubbedTime()
return delegate.getSnubbedTime();
|
public int | getState()
int state = delegate.getPeerState();
switch( state ){
case PEPeer.CONNECTING:
{
return( Peer.CONNECTING );
}
case PEPeer.DISCONNECTED:
{
return( Peer.DISCONNECTED );
}
case PEPeer.HANDSHAKING:
{
return( Peer.HANDSHAKING );
}
case PEPeer.TRANSFERING:
{
return( Peer.TRANSFERING );
}
}
return( -1 );
|
public PeerStats | getStats()
return( new PeerStatsImpl(manager, this, delegate.getStats()));
|
public org.gudy.azureus2.plugins.messaging.Message[] | getSupportedMessages()
com.aelitis.azureus.core.peermanager.messaging.Message[] core_msgs = delegate.getSupportedMessages();
Message[] plug_msgs = new Message[ core_msgs.length ];
for( int i=0; i < core_msgs.length; i++ ) {
plug_msgs[i] = new MessageAdapter( core_msgs[i] );
}
return plug_msgs;
|
public int | getTCPListenPort() return delegate.getTCPListenPort();
|
public int | getUDPListenPort() return delegate.getUDPListenPort();
|
public int | getUDPNonDataListenPort() return delegate.getUDPNonDataListenPort();
|
public java.lang.Object | getUserData(java.lang.Object key)
if ( user_data == null ){
return( null );
}
return( user_data.get( key ));
|
public int | hashCode()
return( delegate.hashCode());
|
public void | initialize()
throw( new RuntimeException( "not supported"));
|
public boolean | isChoked()
return( delegate.isChokingMe());
|
public boolean | isChoking()
return( delegate.isChokedByMe());
|
public boolean | isDownloadPossible()
return delegate.isDownloadPossible();
|
public boolean | isIncoming()
return( delegate.isIncoming());
|
public boolean | isInterested()
return( delegate.isInteresting());
|
public boolean | isInteresting()
return( delegate.isInterested());
|
public boolean | isOptimisticUnchoke()
return( delegate.isOptimisticUnchoke());
|
public boolean | isPieceAvailable(int pieceNumber)
return delegate.isPieceAvailable(pieceNumber);
|
public boolean | isSeed()
return( delegate.isSeed());
|
public boolean | isSnubbed()
return( delegate.isSnubbed());
|
public boolean | isTransferAvailable()
return( delegate.transferAvailable());
|
public int | readBytes(int max)
throw( new RuntimeException( "not supported"));
|
public void | removeListener(PeerListener l)
if ( peer_listeners != null ){
PEPeerListener core_listener = (PEPeerListener)peer_listeners.remove( l );
if( core_listener != null ) {
delegate.removeListener( core_listener );
}
}
|
public void | removeListener(PeerListener2 l)
if ( peer_listeners != null ){
PEPeerListener core_listener = (PEPeerListener)peer_listeners.remove( l );
if( core_listener != null ) {
delegate.removeListener( core_listener );
}
}
|
public void | requestAllocationComplete()
throw( new RuntimeException( "not supported"));
|
public boolean | requestAllocationStarts(int[] base_priorities)
throw( new RuntimeException( "not supported"));
|
public void | setOptimisticUnchoke(boolean is_optimistic)
delegate.setOptimisticUnchoke( is_optimistic );
|
public void | setSnubbed(boolean b)
delegate.setSnubbed(b);
|
public void | setUserData(java.lang.Object key, java.lang.Object value)
if ( user_data == null ){
user_data = new HashMap();
}
user_data.put( key, value );
|
public boolean | supportsMessaging()
return delegate.supportsMessaging();
|
public int | writeBytes(int max)
throw( new RuntimeException( "not supported"));
|