TRHostTorrent host_torrent = host.getHostTorrent( torrent );
if ( host_torrent != null ){
// it we remove a torrent while it is hosted then we flip it into passive mode to
// keep it around in a sensible state
// we've got to ensure that the torrent's file location is available in the torrent itself
// as we're moving from download-managed persistence to host managed :(
// check file already exists - might have already been deleted as in the
// case of shared resources
File torrent_file = new File( torrent_file_str );
if ( torrent_file.exists()){
try{
TorrentUtils.writeToFile( host_torrent.getTorrent(), torrent_file, false );
host_torrent.setPassive( true );
}catch( Throwable e ){
Debug.out( "Failed to make torrent '" + torrent_file_str + "' passive: " + Debug.getNestedExceptionMessage(e));
}
}
}