Package org.klomp.snark
Class PeerConnectionOut
java.lang.Object
org.klomp.snark.PeerConnectionOut
- All Implemented Interfaces:
Runnable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidcancelRequest(int piece, int begin, int length) Called by the PeerState when the other side doesn't want this request to be handled anymore.(package private) voidRemove all Request messages from the queue.void(package private) int(package private) voidretransmitRequests(List<Request> requests) voidrun()Continuesly monitors for more outgoing messages that have to be send.(package private) void(package private) voidsendBitfield(BitField bitfield) (package private) voidsendCancel(Request req) send cancel(package private) voidsendChoke(boolean choke) (package private) voidsendExtension(int id, byte[] bytes) (package private) voidsendHave(int piece) (package private) voidsendInterest(boolean interest) (package private) voidsendPiece(int piece, int begin, int length, DataLoader loader) Queue a piece message with a callback to load the data from disk when required.(package private) voidsendPort(int port) (package private) voidsendReject(int piece, int begin, int length) (package private) voidsendRequest(Request req) (package private) voidsendRequests(List<Request> requests) voidstartup()
-
Field Details
-
lastSent
long lastSent
-
-
Constructor Details
-
PeerConnectionOut
-
-
Method Details
-
startup
public void startup() -
run
public void run()Continuesly monitors for more outgoing messages that have to be send. Stops if quit is true or an IOException occurs. -
disconnect
public void disconnect() -
sendAlive
void sendAlive() -
sendChoke
void sendChoke(boolean choke) -
sendInterest
void sendInterest(boolean interest) -
sendHave
void sendHave(int piece) -
sendBitfield
-
retransmitRequests
-
sendRequests
-
sendRequest
-
queuedBytes
int queuedBytes() -
sendPiece
Queue a piece message with a callback to load the data from disk when required.- Since:
- 0.8.2
-
sendCancel
send cancel -
cancelRequestMessages
void cancelRequestMessages()Remove all Request messages from the queue. Does not send a cancel message.- Since:
- 0.8.2
-
cancelRequest
void cancelRequest(int piece, int begin, int length) Called by the PeerState when the other side doesn't want this request to be handled anymore. Removes any pending Piece Message from out send queue. Does not send a cancel message. -
sendExtension
void sendExtension(int id, byte[] bytes) - Since:
- 0.8.2
-
sendPort
void sendPort(int port) - Since:
- 0.8.4
-
sendReject
void sendReject(int piece, int begin, int length) - Since:
- 0.9.21
-