FileDocCategorySizeDatePackage
Peer.javaAPI DocAzureus 3.0.3.45723Fri Aug 31 16:09:44 BST 2007org.gudy.azureus2.plugins.peers

Peer

public interface Peer
author
parg

Fields Summary
public static final int
CONNECTING
public static final int
HANDSHAKING
public static final int
TRANSFERING
public static final int
CLOSING
public static final int
DISCONNECTED
Constructors Summary
Methods Summary
public voidaddListener(PeerListener listener)
Add peer listener.

param
listener
deprecated
use addListener( PeerListener2 )

public voidaddListener(PeerListener2 listener)
Add peer listener.

param
listener

public booleanaddRequest(PeerReadRequest request)

public voidcancelRequest(PeerReadRequest request)

public voidclose(java.lang.String reason, boolean closedOnError, boolean attemptReconnect)

public boolean[]getAvailable()

public java.lang.StringgetClient()

public org.gudy.azureus2.plugins.network.ConnectiongetConnection()
Get the network connection that backs this peer.

return
connection

public java.util.ListgetExpiredRequests()

public byte[]getHandshakeReservedBytes()

public byte[]getId()

public java.lang.StringgetIp()
Get the peer's local TCP connection port.

return
local port

public PeerManagergetManager()

public intgetMaximumNumberOfRequests()

public intgetNumberOfRequests()

public intgetPercentDone()

deprecated
This erroneously returns percent in 1000 (i.e. 100% = 1000 :) Therefore replaces with something more accurately named!
return

public intgetPercentDoneInThousandNotation()

public intgetPercentDoneOfCurrentIncomingRequest()

public intgetPercentDoneOfCurrentOutgoingRequest()

public intgetPort()

public int[]getPriorityOffsets()

public java.util.MapgetProperties()
Get a set of properties associated with the peer

return

public java.util.ListgetRequests()

public longgetSnubbedTime()

public intgetState()

public PeerStatsgetStats()

public org.gudy.azureus2.plugins.messaging.Message[]getSupportedMessages()
Get the list of messages that this peer and us mutually understand.

return
messages available for use, or null of supported is yet unknown

public intgetTCPListenPort()
Get the TCP port this peer is listening for incoming connections on.

return
TCP port, or 0 if port is unknown

public intgetUDPListenPort()
Get the UDP port this peer is listening for incoming connections on.

return
UDP port, or 0 if port is unknown

public intgetUDPNonDataListenPort()
Get the UDP port this peer is listening on for non-data connections

return

public java.lang.ObjectgetUserData(java.lang.Object key)

public booleanisChoked()

public booleanisChoking()

public booleanisDownloadPossible()
This is much list isTransferAvailable(), except is more comprehensive. That is; it checks a few more factors, within the object for speed, so that a more timely status is considered and the caller doesn't need to try to check each thing on it's own.

return
true if several factors say downloading can be tried.

public booleanisIncoming()

public booleanisInterested()

public booleanisInteresting()

public booleanisOptimisticUnchoke()

public booleanisPieceAvailable(int pieceNumber)

param
pieceNumber int
return
true if this peers makes this piece available

public booleanisSeed()

public booleanisSnubbed()

public booleanisTransferAvailable()

public intreadBytes(int max)
Rate control - gives the maximum number of bytes that can be read from this connection at this time and returns the actual number read

param
max
return

public voidremoveListener(PeerListener listener)
Remove peer listener.

param
listener
deprecated
use removeListener( PeerListener2 )

public voidremoveListener(PeerListener2 listener)
Remove peer listener.

param
listener

public voidrequestAllocationComplete()

public booleanrequestAllocationStarts(int[] base_priorities)

public voidsetOptimisticUnchoke(boolean is_optimistic)

public voidsetSnubbed(boolean b)

public voidsetUserData(java.lang.Object key, java.lang.Object value)

public booleansupportsMessaging()
Whether or not this peer supports the advanced messaging API.

return
true if extended messaging is supported, false if not

public intwriteBytes(int max)