修飾子とタイプ | フィールド | 説明 |
---|---|---|
(package private) static long |
CHECK_PERIOD |
|
(package private) MagnetState |
magnetState |
shared across all peers on this torrent
|
(package private) static int |
RATE_DEPTH |
|
(package private) PeerState |
state |
コンストラクタ | 説明 |
---|---|
Peer(I2PSocket sock,
java.io.InputStream in,
java.io.OutputStream out,
byte[] my_id,
byte[] infohash,
MetaInfo metainfo) |
Incoming connection.
|
Peer(PeerID peerID,
byte[] my_id,
byte[] infohash,
MetaInfo metainfo) |
Outgoing connection.
|
修飾子とタイプ | メソッド | 説明 |
---|---|---|
(package private) void |
cancel(int piece) |
Tell the other side that we are no longer interested in any of
the outstanding requests (if any) for this piece.
|
int |
compareTo(Peer p) |
推奨されていません。
unused?
|
int |
completed() |
Return how much the peer has
|
(package private) void |
disconnect() |
|
void |
disconnect(boolean deregister) |
Disconnects this peer if it was connected.
|
void |
downloaded(int size) |
Increment the counter.
|
boolean |
equals(java.lang.Object o) |
Two Peers are equal when they have the same PeerID.
|
Destination |
getDestination() |
|
long |
getDownloaded() |
Returns the number of bytes that have been downloaded.
|
long |
getDownloadRate() |
|
java.util.Map<java.lang.String,BEValue> |
getHandshakeMap() |
|
long |
getInactiveTime() |
|
MagnetState |
getMagnetState() |
Shared state across all peers, callers must sync on returned object
|
PeerID |
getPeerID() |
Returns the id of the peer.
|
java.lang.String |
getSocket() |
|
(package private) int |
getTotalCommentsSent() |
|
long |
getUploaded() |
Returns the number of bytes that have been uploaded.
|
long |
getUploadRate() |
Returns the 4-minute-average rate in Bps
|
int |
hashCode() |
The hash code of a Peer is the hash code of the peerID.
|
void |
have(int piece) |
Tell the peer we have another piece.
|
boolean |
isChoked() |
Whether or not the peer choked us.
|
boolean |
isChoking() |
Whether or not we are choking the peer.
|
boolean |
isCompleted() |
Return if a peer is a seeder
|
boolean |
isConnected() |
|
boolean |
isIncoming() |
Is this an incoming connection?
For RPC
|
boolean |
isInterested() |
Whether or not the peer is interested in pieces we have.
|
boolean |
isInteresting() |
Whether or not the peer has pieces we want from it.
|
(package private) boolean |
isRequesting(int p) |
推奨されていません。
deadlocks
|
void |
keepAlive() |
Send keepalive
|
(package private) void |
request() |
Update the request queue.
|
void |
resetCounters() |
Resets the downloaded and uploaded counters to zero.
|
void |
retransmitRequests() |
Retransmit outstanding requests if necessary
|
void |
runConnection(I2PSnarkUtil util,
PeerListener listener,
BitField bitfield,
MagnetState mState,
boolean uploadOnly) |
Runs the connection to the other peer.
|
void |
sendExtension(int type,
byte[] payload) |
|
void |
setChoking(boolean choke) |
Sets whether or not we are choking the peer.
|
void |
setHandshakeMap(java.util.Map<java.lang.String,BEValue> map) |
|
void |
setInteresting(boolean interest) |
推奨されていません。
unused
|
void |
setMetaInfo(MetaInfo meta) |
Switch from magnet mode to normal mode
|
void |
setRateHistory(long up,
long down) |
Push the total uploaded/downloaded onto a RATE_DEPTH deep stack
|
(package private) void |
setTotalCommentsSent(int count) |
|
boolean |
supportsFast() |
|
java.lang.String |
toString() |
Returns the String representation of the peerID.
|
void |
uploaded(int size) |
Increment the counter.
|
volatile PeerState state
MagnetState magnetState
static final long CHECK_PERIOD
static final int RATE_DEPTH
public Peer(PeerID peerID, byte[] my_id, byte[] infohash, MetaInfo metainfo)
metainfo
- null if in magnet modepublic Peer(I2PSocket sock, java.io.InputStream in, java.io.OutputStream out, byte[] my_id, byte[] infohash, MetaInfo metainfo) throws java.io.IOException
metainfo
- null if in magnet modejava.io.IOException
- when an error occurred during the handshake.public boolean isIncoming()
public PeerID getPeerID()
public java.lang.String toString()
toString
クラス内 java.lang.Object
public java.lang.String getSocket()
public int hashCode()
hashCode
クラス内 java.lang.Object
public boolean equals(java.lang.Object o)
equals
クラス内 java.lang.Object
@Deprecated public int compareTo(Peer p)
compareTo
インタフェース内 java.lang.Comparable<Peer>
public void runConnection(I2PSnarkUtil util, PeerListener listener, BitField bitfield, MagnetState mState, boolean uploadOnly)
uploadOnly
- if we are complete with skipped files, i.e. a partial seedpublic boolean supportsFast()
public Destination getDestination()
public MagnetState getMagnetState()
public java.util.Map<java.lang.String,BEValue> getHandshakeMap()
public void setHandshakeMap(java.util.Map<java.lang.String,BEValue> map)
public void sendExtension(int type, byte[] payload)
public void setMetaInfo(MetaInfo meta)
public boolean isConnected()
public void disconnect(boolean deregister)
void disconnect()
public void have(int piece)
void cancel(int piece)
@Deprecated boolean isRequesting(int p)
void request()
public boolean isInterested()
@Deprecated public void setInteresting(boolean interest)
public boolean isInteresting()
public void setChoking(boolean choke)
public boolean isChoking()
public boolean isChoked()
public void downloaded(int size)
public void uploaded(int size)
public long getDownloaded()
resetCounters()
/public long getUploaded()
resetCounters()
/public void resetCounters()
public long getInactiveTime()
public void keepAlive()
public void retransmitRequests()
public int completed()
public boolean isCompleted()
public void setRateHistory(long up, long down)
public long getUploadRate()
public long getDownloadRate()
int getTotalCommentsSent()
void setTotalCommentsSent(int count)