|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Peer
Field Summary | |
---|---|
static int |
CLOSING
|
static int |
CONNECTING
|
static int |
DISCONNECTED
|
static int |
HANDSHAKING
|
static java.lang.Object |
PR_PRIORITY_CONNECTION
|
static java.lang.Object |
PR_PROTOCOL
|
static java.lang.Object |
PR_PROTOCOL_QUALIFIER
|
static int |
TRANSFERING
|
Method Summary | |
---|---|
void |
addListener(PeerListener listener)
Deprecated. use addListener( PeerListener2 ) |
void |
addListener(PeerListener2 listener)
Add peer listener. |
void |
addRateLimiter(RateLimiter limiter,
boolean is_upload)
|
boolean |
addRequest(PeerReadRequest request)
|
void |
bindConnection(ConnectionStub stub)
|
void |
cancelRequest(PeerReadRequest request)
|
void |
close(java.lang.String reason,
boolean closedOnError,
boolean attemptReconnect)
|
boolean[] |
getAvailable()
|
java.lang.String |
getClient()
|
Connection |
getConnection()
Get the network connection that backs this peer. |
java.util.List |
getExpiredRequests()
|
byte[] |
getHandshakeReservedBytes()
|
byte[] |
getId()
|
java.lang.String |
getIp()
Get the peer's local TCP connection port. |
PeerManager |
getManager()
|
int |
getMaximumNumberOfRequests()
|
int |
getNumberOfRequests()
|
int |
getOutgoingRequestCount()
|
int[] |
getOutgoingRequestedPieceNumbers()
|
int |
getPercentDone()
Deprecated. This erroneously returns percent in 1000 (i.e. 100% = 1000 :) Therefore replaces with something more accurately named! |
int |
getPercentDoneInThousandNotation()
|
int |
getPercentDoneOfCurrentIncomingRequest()
|
int |
getPercentDoneOfCurrentOutgoingRequest()
|
int |
getPort()
|
int[] |
getPriorityOffsets()
|
RateLimiter[] |
getRateLimiters(boolean is_upload)
|
java.util.List |
getRequests()
|
long |
getSnubbedTime()
|
int |
getState()
|
PeerStats |
getStats()
|
Message[] |
getSupportedMessages()
Get the list of messages that this peer and us mutually understand. |
int |
getTCPListenPort()
Get the TCP port this peer is listening for incoming connections on. |
int |
getUDPListenPort()
Get the UDP port this peer is listening for incoming connections on. |
int |
getUDPNonDataListenPort()
Get the UDP port this peer is listening on for non-data connections |
java.lang.Object |
getUserData(java.lang.Object key)
|
boolean |
isChoked()
|
boolean |
isChoking()
|
boolean |
isDownloadPossible()
This is much list isTransferAvailable(), except is more comprehensive. |
boolean |
isIncoming()
|
boolean |
isInterested()
|
boolean |
isInteresting()
|
boolean |
isLANLocal()
|
boolean |
isOptimisticUnchoke()
|
boolean |
isPieceAvailable(int pieceNumber)
|
boolean |
isPriorityConnection()
|
boolean |
isSeed()
|
boolean |
isSnubbed()
|
boolean |
isTransferAvailable()
|
int |
readBytes(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 |
void |
removeListener(PeerListener listener)
Deprecated. use removeListener( PeerListener2 ) |
void |
removeListener(PeerListener2 listener)
Remove peer listener. |
void |
removeRateLimiter(RateLimiter limiter,
boolean is_upload)
|
void |
requestAllocationComplete()
|
boolean |
requestAllocationStarts(int[] base_priorities)
|
void |
setOptimisticUnchoke(boolean is_optimistic)
|
void |
setPriorityConnection(boolean is_priority)
|
void |
setSnubbed(boolean b)
|
void |
setUserData(java.lang.Object key,
java.lang.Object value)
|
boolean |
supportsMessaging()
Whether or not this peer supports the advanced messaging API. |
int |
writeBytes(int max)
|
Field Detail |
---|
static final int CONNECTING
static final int HANDSHAKING
static final int TRANSFERING
static final int CLOSING
static final int DISCONNECTED
static final java.lang.Object PR_PRIORITY_CONNECTION
static final java.lang.Object PR_PROTOCOL
static final java.lang.Object PR_PROTOCOL_QUALIFIER
Method Detail |
---|
void bindConnection(ConnectionStub stub)
PeerManager getManager()
int getState()
byte[] getId()
java.lang.String getIp()
int getTCPListenPort()
int getUDPListenPort()
int getUDPNonDataListenPort()
int getPort()
boolean isLANLocal()
boolean[] getAvailable()
boolean isPieceAvailable(int pieceNumber)
pieceNumber
- int
boolean isTransferAvailable()
int readBytes(int max)
max
-
int writeBytes(int max)
boolean isDownloadPossible()
boolean isChoked()
boolean isChoking()
boolean isInterested()
boolean isInteresting()
boolean isSeed()
boolean isSnubbed()
long getSnubbedTime()
void setSnubbed(boolean b)
PeerStats getStats()
boolean isIncoming()
int getPercentDone()
int getPercentDoneInThousandNotation()
java.lang.String getClient()
boolean isOptimisticUnchoke()
void setOptimisticUnchoke(boolean is_optimistic)
java.util.List getExpiredRequests()
java.util.List getRequests()
int getMaximumNumberOfRequests()
int getNumberOfRequests()
void cancelRequest(PeerReadRequest request)
boolean requestAllocationStarts(int[] base_priorities)
int[] getPriorityOffsets()
void requestAllocationComplete()
boolean addRequest(PeerReadRequest request)
void close(java.lang.String reason, boolean closedOnError, boolean attemptReconnect)
int getPercentDoneOfCurrentIncomingRequest()
int[] getOutgoingRequestedPieceNumbers()
int getOutgoingRequestCount()
int getPercentDoneOfCurrentOutgoingRequest()
void addListener(PeerListener listener)
listener
- void removeListener(PeerListener listener)
listener
- void addListener(PeerListener2 listener)
listener
- void removeListener(PeerListener2 listener)
listener
- Connection getConnection()
boolean supportsMessaging()
Message[] getSupportedMessages()
void setUserData(java.lang.Object key, java.lang.Object value)
java.lang.Object getUserData(java.lang.Object key)
byte[] getHandshakeReservedBytes()
boolean isPriorityConnection()
void setPriorityConnection(boolean is_priority)
void addRateLimiter(RateLimiter limiter, boolean is_upload)
limiter
- create via ConnectionManageris_upload
- false -> download limitvoid removeRateLimiter(RateLimiter limiter, boolean is_upload)
RateLimiter[] getRateLimiters(boolean is_upload)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |