BTTorrentSessionpublic class BTTorrentSession extends Object implements TorrentSession
Fields Summary |
---|
private final TorrentSessionListener | listener | private final com.aelitis.azureus.core.peermanager.connection.AZPeerConnection | peer | private final IncomingMessageQueue.MessageQueueListener | incoming_q_listener | private final OutgoingMessageQueue.MessageQueueListener | sent_message_listener |
Constructors Summary |
---|
public BTTorrentSession(com.aelitis.azureus.core.peermanager.connection.AZPeerConnection peer, TorrentSessionListener listener)
this.peer = peer;
this.listener = listener;
peer.getNetworkConnection().getIncomingMessageQueue().registerQueueListener( incoming_q_listener );
peer.getNetworkConnection().getOutgoingMessageQueue().registerQueueListener( sent_message_listener );
listener.sessionIsEstablished(); //notify of readiness
|
Methods Summary |
---|
public void | endSession(java.lang.String reason)
peer.getNetworkConnection().getIncomingMessageQueue().cancelQueueListener( incoming_q_listener );
peer.getNetworkConnection().getOutgoingMessageQueue().cancelQueueListener( sent_message_listener );
| public void | sendSessionBitfield(org.gudy.azureus2.core3.util.DirectByteBuffer bitfield)
peer.getNetworkConnection().getOutgoingMessageQueue().addMessage( new BTBitfield( bitfield, (byte)1 ), false );
| public void | sendSessionCancel(int piece_number, int piece_offset, int length)
peer.getNetworkConnection().getOutgoingMessageQueue().addMessage( new BTCancel( piece_number, piece_offset, length, (byte)1 ), false );
| public void | sendSessionHave(int[] piece_numbers)
for( int i=0; i < piece_numbers.length; i++ ) {
peer.getNetworkConnection().getOutgoingMessageQueue().addMessage( new BTHave( piece_numbers[i], (byte)1 ), false );
}
| public java.lang.Object | sendSessionPiece(int piece_number, int piece_offset, org.gudy.azureus2.core3.util.DirectByteBuffer data)
BTPiece piece = new BTPiece( piece_number, piece_offset, data, (byte)1 );
peer.getNetworkConnection().getOutgoingMessageQueue().addMessage( piece, false );
return piece;
| public void | sendSessionRequest(byte unchoke_id, int piece_number, int piece_offset, int length)
peer.getNetworkConnection().getOutgoingMessageQueue().addMessage( new BTRequest( piece_number, piece_offset, length, (byte)1 ), false );
|
|