Methods Summary |
---|
public void | deregisterForSessionManagement(com.aelitis.azureus.core.peermanager.download.TorrentDownload download)Deregister the given download from torrent session management.
try{ hashes_mon.enter();
hashes.remove( new HashWrapper( download.getInfoHash() ) );
}
finally{ hashes_mon.exit(); }
|
public static com.aelitis.azureus.core.peermanager.download.session.TorrentSessionManager | getSingleton()
return instance;
|
public void | init()
//register for new peer connection creation notification, so that we can catch torrent session syn messages
PeerConnectionFactory.getSingleton().registerCreationListener( new PeerConnectionFactory.CreationListener() {
public void connectionCreated( final AZPeerConnection connection ) {
connection.getNetworkConnection().getIncomingMessageQueue().registerQueueListener( new IncomingMessageQueue.MessageQueueListener() {
public boolean messageReceived( Message message ) {
if( message.getID().equals( AZMessage.ID_AZ_SESSION_SYN ) ) {
AZSessionSyn syn = (AZSessionSyn)message;
byte[] hash = syn.getInfoHash();
//check for valid session infohash
TorrentDownload download = null;
try{ hashes_mon.enter();
download = (TorrentDownload)hashes.get( new HashWrapper( hash ) );
}
finally{ hashes_mon.exit(); }
if( download == null ) {
System.out.println( "unknown session infohash " +ByteFormatter.nicePrint( hash, true ) );
AZSessionEnd end = new AZSessionEnd( hash, "unknown session infohash", (byte)1 );
connection.getNetworkConnection().getOutgoingMessageQueue().addMessage( end, false );
}
else { //success
//TODO
//TorrentSession session = TorrentSessionFactory.getSingleton().createIncomingSession( download, connection, syn.getSessionID() );
//session.authenticate( syn.getSessionInfo() ); //init processing //TODO
}
syn.destroy();
return true;
}
return false;
}
public void protocolBytesReceived( int byte_count ){}
public void dataBytesReceived( int byte_count ){}
});
}
});
|
public void | registerForSessionManagement(com.aelitis.azureus.core.peermanager.download.TorrentDownload download)Register the given download for torrent session management.
try{ hashes_mon.enter();
hashes.put( new HashWrapper( download.getInfoHash() ), download );
}
finally{ hashes_mon.exit(); }
|
public void | requestTorrentSession(com.aelitis.azureus.core.peermanager.download.TorrentDownload download, AZPeerConnection connection)Initiate a torrent session for the given download with the given peer connection.
//TorrentSession session = TorrentSessionFactory.getSingleton().createOutgoingSession( download, connection );
//session.authenticate( null ); //init processing //TODO
|