(libT) housekeeping: tr_torrent.handle --> tr_torrent.session
This commit is contained in:
parent
9337a6f69f
commit
b1ef118e3f
|
@ -615,7 +615,7 @@ parsePeers( tr_torrent * tor,
|
||||||
{
|
{
|
||||||
tr_pex pex;
|
tr_pex pex;
|
||||||
readBytes( &pex, &buf, sizeof( tr_pex ) );
|
readBytes( &pex, &buf, sizeof( tr_pex ) );
|
||||||
tr_peerMgrAddPex( tor->handle->peerMgr, tor->info.hash,
|
tr_peerMgrAddPex( tor->session->peerMgr, tor->info.hash,
|
||||||
TR_PEER_FROM_CACHE,
|
TR_PEER_FROM_CACHE,
|
||||||
&pex );
|
&pex );
|
||||||
}
|
}
|
||||||
|
@ -713,13 +713,13 @@ loadResumeFile( const tr_torrent * tor,
|
||||||
{
|
{
|
||||||
uint8_t * ret = NULL;
|
uint8_t * ret = NULL;
|
||||||
char path[MAX_PATH_LENGTH];
|
char path[MAX_PATH_LENGTH];
|
||||||
const char * cacheDir = tr_getResumeDir( tor->handle );
|
const char * cacheDir = tr_getResumeDir( tor->session );
|
||||||
const char * hash = tor->info.hashString;
|
const char * hash = tor->info.hashString;
|
||||||
|
|
||||||
if( !ret && tor->handle->tag )
|
if( !ret && tor->session->tag )
|
||||||
{
|
{
|
||||||
char base[1024];
|
char base[1024];
|
||||||
tr_snprintf( base, sizeof( base ), "%s-%s", hash, tor->handle->tag );
|
tr_snprintf( base, sizeof( base ), "%s-%s", hash, tor->session->tag );
|
||||||
tr_buildPath( path, sizeof( path ), cacheDir, base, NULL );
|
tr_buildPath( path, sizeof( path ), cacheDir, base, NULL );
|
||||||
ret = tr_loadFile( path, len );
|
ret = tr_loadFile( path, len );
|
||||||
}
|
}
|
||||||
|
@ -776,13 +776,13 @@ void
|
||||||
tr_fastResumeRemove( const tr_torrent * tor )
|
tr_fastResumeRemove( const tr_torrent * tor )
|
||||||
{
|
{
|
||||||
char path[MAX_PATH_LENGTH];
|
char path[MAX_PATH_LENGTH];
|
||||||
const char * cacheDir = tr_getResumeDir( tor->handle );
|
const char * cacheDir = tr_getResumeDir( tor->session );
|
||||||
const char * hash = tor->info.hashString;
|
const char * hash = tor->info.hashString;
|
||||||
|
|
||||||
if( tor->handle->tag )
|
if( tor->session->tag )
|
||||||
{
|
{
|
||||||
char base[1024];
|
char base[1024];
|
||||||
tr_snprintf( base, sizeof( base ), "%s-%s", hash, tor->handle->tag );
|
tr_snprintf( base, sizeof( base ), "%s-%s", hash, tor->session->tag );
|
||||||
tr_buildPath( path, sizeof( path ), cacheDir, base, NULL );
|
tr_buildPath( path, sizeof( path ), cacheDir, base, NULL );
|
||||||
unlink( path );
|
unlink( path );
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ readOrWriteBytes( const tr_torrent * tor,
|
||||||
err = TR_OK;
|
err = TR_OK;
|
||||||
|
|
||||||
if( ( err == TR_OK ) && ( !fileExists ) && ( ioMode == TR_IO_WRITE ) )
|
if( ( err == TR_OK ) && ( !fileExists ) && ( ioMode == TR_IO_WRITE ) )
|
||||||
tr_statsFileCreated( tor->handle );
|
tr_statsFileCreated( tor->session );
|
||||||
|
|
||||||
if( fd >= 0 )
|
if( fd >= 0 )
|
||||||
tr_fdFileReturn( fd );
|
tr_fdFileReturn( fd );
|
||||||
|
|
|
@ -889,7 +889,7 @@ peerCallbackFunc( void * vpeer,
|
||||||
tr_torrent * tor = t->tor;
|
tr_torrent * tor = t->tor;
|
||||||
tor->activityDate = now;
|
tor->activityDate = now;
|
||||||
tor->uploadedCur += e->length;
|
tor->uploadedCur += e->length;
|
||||||
tr_statsAddUploaded( tor->handle, e->length );
|
tr_statsAddUploaded( tor->session, e->length );
|
||||||
if( peer )
|
if( peer )
|
||||||
{
|
{
|
||||||
struct peer_atom * atom = getExistingAtom( t,
|
struct peer_atom * atom = getExistingAtom( t,
|
||||||
|
@ -912,7 +912,7 @@ peerCallbackFunc( void * vpeer,
|
||||||
* into the jurisdiction of the tracker." */
|
* into the jurisdiction of the tracker." */
|
||||||
if( peer )
|
if( peer )
|
||||||
tor->downloadedCur += e->length;
|
tor->downloadedCur += e->length;
|
||||||
tr_statsAddDownloaded( tor->handle, e->length );
|
tr_statsAddDownloaded( tor->session, e->length );
|
||||||
if( peer )
|
if( peer )
|
||||||
{
|
{
|
||||||
struct peer_atom * atom = getExistingAtom( t,
|
struct peer_atom * atom = getExistingAtom( t,
|
||||||
|
@ -971,7 +971,7 @@ peerCallbackFunc( void * vpeer,
|
||||||
|
|
||||||
tr_torrentSetHasPiece( tor, p, !err );
|
tr_torrentSetHasPiece( tor, p, !err );
|
||||||
tr_torrentSetPieceChecked( tor, p, TRUE );
|
tr_torrentSetPieceChecked( tor, p, TRUE );
|
||||||
tr_peerMgrSetBlame( tor->handle->peerMgr, tor->info.hash, p,
|
tr_peerMgrSetBlame( tor->session->peerMgr, tor->info.hash, p,
|
||||||
!err );
|
!err );
|
||||||
|
|
||||||
if( err )
|
if( err )
|
||||||
|
|
|
@ -2092,7 +2092,7 @@ tr_peerMsgsNew( struct tr_torrent * torrent,
|
||||||
m = tr_new0( tr_peermsgs, 1 );
|
m = tr_new0( tr_peermsgs, 1 );
|
||||||
m->publisher = tr_publisherNew( );
|
m->publisher = tr_publisherNew( );
|
||||||
m->info = info;
|
m->info = info;
|
||||||
m->session = torrent->handle;
|
m->session = torrent->session;
|
||||||
m->torrent = torrent;
|
m->torrent = torrent;
|
||||||
m->io = info->io;
|
m->io = info->io;
|
||||||
m->info->clientIsChoked = 1;
|
m->info->clientIsChoked = 1;
|
||||||
|
|
|
@ -51,7 +51,7 @@ static char*
|
||||||
getResumeFilename( const tr_torrent * tor )
|
getResumeFilename( const tr_torrent * tor )
|
||||||
{
|
{
|
||||||
return tr_strdup_printf( "%s%c%s.%16.16s.resume",
|
return tr_strdup_printf( "%s%c%s.%16.16s.resume",
|
||||||
tr_getResumeDir( tor->handle ),
|
tr_getResumeDir( tor->session ),
|
||||||
TR_PATH_DELIMITER,
|
TR_PATH_DELIMITER,
|
||||||
tor->info.name,
|
tor->info.name,
|
||||||
tor->info.hashString );
|
tor->info.hashString );
|
||||||
|
@ -66,7 +66,7 @@ savePeers( tr_benc * dict,
|
||||||
const tr_torrent * tor )
|
const tr_torrent * tor )
|
||||||
{
|
{
|
||||||
tr_pex * pex = NULL;
|
tr_pex * pex = NULL;
|
||||||
const int count = tr_peerMgrGetPeers( tor->handle->peerMgr,
|
const int count = tr_peerMgrGetPeers( tor->session->peerMgr,
|
||||||
tor->info.hash, &pex );
|
tor->info.hash, &pex );
|
||||||
|
|
||||||
if( count > 0 )
|
if( count > 0 )
|
||||||
|
@ -90,7 +90,7 @@ loadPeers( tr_benc * dict,
|
||||||
{
|
{
|
||||||
tr_pex pex;
|
tr_pex pex;
|
||||||
memcpy( &pex, str + ( i * sizeof( tr_pex ) ), sizeof( tr_pex ) );
|
memcpy( &pex, str + ( i * sizeof( tr_pex ) ), sizeof( tr_pex ) );
|
||||||
tr_peerMgrAddPex( tor->handle->peerMgr,
|
tr_peerMgrAddPex( tor->session->peerMgr,
|
||||||
tor->info.hash, TR_PEER_FROM_CACHE, &pex );
|
tor->info.hash, TR_PEER_FROM_CACHE, &pex );
|
||||||
}
|
}
|
||||||
tr_tordbg( tor, "Loaded %d peers from resume file", count );
|
tr_tordbg( tor, "Loaded %d peers from resume file", count );
|
||||||
|
|
|
@ -126,13 +126,13 @@ tr_torrentFindFromObfuscatedHash( tr_handle * handle,
|
||||||
void
|
void
|
||||||
tr_torrentLock( const tr_torrent * tor )
|
tr_torrentLock( const tr_torrent * tor )
|
||||||
{
|
{
|
||||||
tr_globalLock( tor->handle );
|
tr_globalLock( tor->session );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tr_torrentUnlock( const tr_torrent * tor )
|
tr_torrentUnlock( const tr_torrent * tor )
|
||||||
{
|
{
|
||||||
tr_globalUnlock( tor->handle );
|
tr_globalUnlock( tor->session );
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
@ -222,7 +222,7 @@ onTrackerResponse( void * tracker UNUSED,
|
||||||
{
|
{
|
||||||
if( event->allAreSeeds )
|
if( event->allAreSeeds )
|
||||||
pex[i].flags |= ADDED_F_SEED_FLAG;
|
pex[i].flags |= ADDED_F_SEED_FLAG;
|
||||||
tr_peerMgrAddPex( tor->handle->peerMgr, tor->info.hash,
|
tr_peerMgrAddPex( tor->session->peerMgr, tor->info.hash,
|
||||||
TR_PEER_FROM_TRACKER, pex + i );
|
TR_PEER_FROM_TRACKER, pex + i );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ torrentRealInit( tr_handle * h,
|
||||||
|
|
||||||
tr_globalLock( h );
|
tr_globalLock( h );
|
||||||
|
|
||||||
tor->handle = h;
|
tor->session = h;
|
||||||
tor->uniqueId = nextUniqueId++;
|
tor->uniqueId = nextUniqueId++;
|
||||||
|
|
||||||
randomizeTiers( info );
|
randomizeTiers( info );
|
||||||
|
@ -537,9 +537,9 @@ torrentRealInit( tr_handle * h,
|
||||||
if( !( loaded & TR_FR_SPEEDLIMIT ) )
|
if( !( loaded & TR_FR_SPEEDLIMIT ) )
|
||||||
{
|
{
|
||||||
tr_torrentSetSpeedLimit( tor, TR_UP,
|
tr_torrentSetSpeedLimit( tor, TR_UP,
|
||||||
tr_sessionGetSpeedLimit( tor->handle, TR_UP ) );
|
tr_sessionGetSpeedLimit( tor->session, TR_UP ) );
|
||||||
tr_torrentSetSpeedLimit( tor, TR_DOWN,
|
tr_torrentSetSpeedLimit( tor, TR_DOWN,
|
||||||
tr_sessionGetSpeedLimit( tor->handle,
|
tr_sessionGetSpeedLimit( tor->session,
|
||||||
TR_DOWN ) );
|
TR_DOWN ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,7 +573,7 @@ torrentRealInit( tr_handle * h,
|
||||||
{
|
{
|
||||||
const char * filename = tor->info.torrent;
|
const char * filename = tor->info.torrent;
|
||||||
tr_bencSaveFile( filename, val );
|
tr_bencSaveFile( filename, val );
|
||||||
tr_sessionSetTorrentFile( tor->handle, tor->info.hashString,
|
tr_sessionSetTorrentFile( tor->session, tor->info.hashString,
|
||||||
filename );
|
filename );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -680,7 +680,7 @@ int
|
||||||
tr_torrentAllowsPex( const tr_torrent * tor )
|
tr_torrentAllowsPex( const tr_torrent * tor )
|
||||||
{
|
{
|
||||||
return tor
|
return tor
|
||||||
&& tor->handle->isPexEnabled
|
&& tor->session->isPexEnabled
|
||||||
&& !tr_torrentIsPrivate( tor );
|
&& !tr_torrentIsPrivate( tor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,7 +696,7 @@ tr_torrentManualUpdateImpl( void * vtor )
|
||||||
void
|
void
|
||||||
tr_torrentManualUpdate( tr_torrent * tor )
|
tr_torrentManualUpdate( tr_torrent * tor )
|
||||||
{
|
{
|
||||||
tr_runInEventThread( tor->handle, tr_torrentManualUpdateImpl, tor );
|
tr_runInEventThread( tor->session, tr_torrentManualUpdateImpl, tor );
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -769,7 +769,7 @@ tr_torrentStat( tr_torrent * tor )
|
||||||
tr_trackerGetCounts( tc, &s->timesCompleted,
|
tr_trackerGetCounts( tc, &s->timesCompleted,
|
||||||
&s->leechers,
|
&s->leechers,
|
||||||
&s->seeders );
|
&s->seeders );
|
||||||
tr_peerMgrTorrentStats( tor->handle->peerMgr,
|
tr_peerMgrTorrentStats( tor->session->peerMgr,
|
||||||
tor->info.hash,
|
tor->info.hash,
|
||||||
&s->peersKnown,
|
&s->peersKnown,
|
||||||
&s->peersConnected,
|
&s->peersConnected,
|
||||||
|
@ -821,7 +821,7 @@ tr_torrentStat( tr_torrent * tor )
|
||||||
{
|
{
|
||||||
tr_piece_index_t i;
|
tr_piece_index_t i;
|
||||||
tr_bitfield * peerPieces = tr_peerMgrGetAvailable(
|
tr_bitfield * peerPieces = tr_peerMgrGetAvailable(
|
||||||
tor->handle->peerMgr,
|
tor->session->peerMgr,
|
||||||
tor->info.
|
tor->info.
|
||||||
hash );
|
hash );
|
||||||
s->desiredAvailable = 0;
|
s->desiredAvailable = 0;
|
||||||
|
@ -941,7 +941,7 @@ tr_torrentFilesFree( tr_file_stat * files,
|
||||||
float*
|
float*
|
||||||
tr_torrentWebSpeeds( const tr_torrent * tor )
|
tr_torrentWebSpeeds( const tr_torrent * tor )
|
||||||
{
|
{
|
||||||
return tor ? tr_peerMgrWebSpeeds( tor->handle->peerMgr, tor->info.hash )
|
return tor ? tr_peerMgrWebSpeeds( tor->session->peerMgr, tor->info.hash )
|
||||||
: NULL;
|
: NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,7 +952,7 @@ tr_torrentPeers( const tr_torrent * tor,
|
||||||
tr_peer_stat * ret = NULL;
|
tr_peer_stat * ret = NULL;
|
||||||
|
|
||||||
if( tor )
|
if( tor )
|
||||||
ret = tr_peerMgrPeerStats( tor->handle->peerMgr,
|
ret = tr_peerMgrPeerStats( tor->session->peerMgr,
|
||||||
tor->info.hash, peerCount );
|
tor->info.hash, peerCount );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -970,7 +970,7 @@ tr_torrentAvailability( const tr_torrent * tor,
|
||||||
int8_t * tab,
|
int8_t * tab,
|
||||||
int size )
|
int size )
|
||||||
{
|
{
|
||||||
tr_peerMgrTorrentAvailability( tor->handle->peerMgr,
|
tr_peerMgrTorrentAvailability( tor->session->peerMgr,
|
||||||
tor->info.hash,
|
tor->info.hash,
|
||||||
tab, size );
|
tab, size );
|
||||||
}
|
}
|
||||||
|
@ -1026,7 +1026,7 @@ static void
|
||||||
freeTorrent( tr_torrent * tor )
|
freeTorrent( tr_torrent * tor )
|
||||||
{
|
{
|
||||||
tr_torrent * t;
|
tr_torrent * t;
|
||||||
tr_handle * h = tor->handle;
|
tr_handle * h = tor->session;
|
||||||
tr_info * inf = &tor->info;
|
tr_info * inf = &tor->info;
|
||||||
|
|
||||||
assert( tor );
|
assert( tor );
|
||||||
|
@ -1077,7 +1077,7 @@ checkAndStartImpl( void * vtor )
|
||||||
{
|
{
|
||||||
tr_torrent * tor = vtor;
|
tr_torrent * tor = vtor;
|
||||||
|
|
||||||
tr_globalLock( tor->handle );
|
tr_globalLock( tor->session );
|
||||||
|
|
||||||
tor->isRunning = 1;
|
tor->isRunning = 1;
|
||||||
*tor->errorString = '\0';
|
*tor->errorString = '\0';
|
||||||
|
@ -1086,22 +1086,22 @@ checkAndStartImpl( void * vtor )
|
||||||
tr_torrentSaveResume( tor );
|
tr_torrentSaveResume( tor );
|
||||||
tor->startDate = time( NULL );
|
tor->startDate = time( NULL );
|
||||||
tr_trackerStart( tor->tracker );
|
tr_trackerStart( tor->tracker );
|
||||||
tr_peerMgrStartTorrent( tor->handle->peerMgr, tor->info.hash );
|
tr_peerMgrStartTorrent( tor->session->peerMgr, tor->info.hash );
|
||||||
|
|
||||||
tr_globalUnlock( tor->handle );
|
tr_globalUnlock( tor->session );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
checkAndStartCB( tr_torrent * tor )
|
checkAndStartCB( tr_torrent * tor )
|
||||||
{
|
{
|
||||||
tr_runInEventThread( tor->handle, checkAndStartImpl, tor );
|
tr_runInEventThread( tor->session, checkAndStartImpl, tor );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
torrentStart( tr_torrent * tor,
|
torrentStart( tr_torrent * tor,
|
||||||
int reloadProgress )
|
int reloadProgress )
|
||||||
{
|
{
|
||||||
tr_globalLock( tor->handle );
|
tr_globalLock( tor->session );
|
||||||
|
|
||||||
if( !tor->isRunning )
|
if( !tor->isRunning )
|
||||||
{
|
{
|
||||||
|
@ -1111,7 +1111,7 @@ torrentStart( tr_torrent * tor,
|
||||||
tr_verifyAdd( tor, checkAndStartCB );
|
tr_verifyAdd( tor, checkAndStartCB );
|
||||||
}
|
}
|
||||||
|
|
||||||
tr_globalUnlock( tor->handle );
|
tr_globalUnlock( tor->session );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1130,7 +1130,7 @@ torrentRecheckDoneImpl( void * vtor )
|
||||||
static void
|
static void
|
||||||
torrentRecheckDoneCB( tr_torrent * tor )
|
torrentRecheckDoneCB( tr_torrent * tor )
|
||||||
{
|
{
|
||||||
tr_runInEventThread( tor->handle, torrentRecheckDoneImpl, tor );
|
tr_runInEventThread( tor->session, torrentRecheckDoneImpl, tor );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1138,12 +1138,12 @@ tr_torrentVerify( tr_torrent * tor )
|
||||||
{
|
{
|
||||||
tr_verifyRemove( tor );
|
tr_verifyRemove( tor );
|
||||||
|
|
||||||
tr_globalLock( tor->handle );
|
tr_globalLock( tor->session );
|
||||||
|
|
||||||
tr_torrentUncheck( tor );
|
tr_torrentUncheck( tor );
|
||||||
tr_verifyAdd( tor, torrentRecheckDoneCB );
|
tr_verifyAdd( tor, torrentRecheckDoneCB );
|
||||||
|
|
||||||
tr_globalUnlock( tor->handle );
|
tr_globalUnlock( tor->session );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1154,7 +1154,7 @@ stopTorrent( void * vtor )
|
||||||
tr_torrent * tor = vtor;
|
tr_torrent * tor = vtor;
|
||||||
|
|
||||||
tr_verifyRemove( tor );
|
tr_verifyRemove( tor );
|
||||||
tr_peerMgrStopTorrent( tor->handle->peerMgr, tor->info.hash );
|
tr_peerMgrStopTorrent( tor->session->peerMgr, tor->info.hash );
|
||||||
tr_trackerStop( tor->tracker );
|
tr_trackerStop( tor->tracker );
|
||||||
|
|
||||||
for( i = 0; i < tor->info.fileCount; ++i )
|
for( i = 0; i < tor->info.fileCount; ++i )
|
||||||
|
@ -1172,14 +1172,14 @@ tr_torrentStop( tr_torrent * tor )
|
||||||
{
|
{
|
||||||
if( tor )
|
if( tor )
|
||||||
{
|
{
|
||||||
tr_globalLock( tor->handle );
|
tr_globalLock( tor->session );
|
||||||
|
|
||||||
tor->isRunning = 0;
|
tor->isRunning = 0;
|
||||||
if( !tor->isDeleting )
|
if( !tor->isDeleting )
|
||||||
tr_torrentSaveResume( tor );
|
tr_torrentSaveResume( tor );
|
||||||
tr_runInEventThread( tor->handle, stopTorrent, tor );
|
tr_runInEventThread( tor->session, stopTorrent, tor );
|
||||||
|
|
||||||
tr_globalUnlock( tor->handle );
|
tr_globalUnlock( tor->session );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1193,7 +1193,7 @@ closeTorrent( void * vtor )
|
||||||
stopTorrent( tor );
|
stopTorrent( tor );
|
||||||
if( tor->isDeleting )
|
if( tor->isDeleting )
|
||||||
{
|
{
|
||||||
tr_metainfoRemoveSaved( tor->handle, &tor->info );
|
tr_metainfoRemoveSaved( tor->session, &tor->info );
|
||||||
tr_torrentRemoveResume( tor );
|
tr_torrentRemoveResume( tor );
|
||||||
}
|
}
|
||||||
freeTorrent( tor );
|
freeTorrent( tor );
|
||||||
|
@ -1204,7 +1204,7 @@ tr_torrentFree( tr_torrent * tor )
|
||||||
{
|
{
|
||||||
if( tor )
|
if( tor )
|
||||||
{
|
{
|
||||||
tr_handle * handle = tor->handle;
|
tr_handle * handle = tor->session;
|
||||||
tr_globalLock( handle );
|
tr_globalLock( handle );
|
||||||
|
|
||||||
tr_torrentClearStatusCallback( tor );
|
tr_torrentClearStatusCallback( tor );
|
||||||
|
@ -1702,7 +1702,7 @@ tr_torrentSetAnnounceList( tr_torrent * tor,
|
||||||
|
|
||||||
/* try to parse it back again, to make sure it's good */
|
/* try to parse it back again, to make sure it's good */
|
||||||
memset( &tmpInfo, 0, sizeof( tr_info ) );
|
memset( &tmpInfo, 0, sizeof( tr_info ) );
|
||||||
if( !tr_metainfoParse( tor->handle, &tmpInfo, &metainfo ) )
|
if( !tr_metainfoParse( tor->session, &tmpInfo, &metainfo ) )
|
||||||
{
|
{
|
||||||
/* if it's good, save it and use it */
|
/* if it's good, save it and use it */
|
||||||
tr_metainfoFree( &tor->info );
|
tr_metainfoFree( &tor->info );
|
||||||
|
|
|
@ -41,31 +41,28 @@ void tr_torrentSetHasPiece( tr_torrent * tor,
|
||||||
tr_piece_index_t pieceIndex,
|
tr_piece_index_t pieceIndex,
|
||||||
int has );
|
int has );
|
||||||
|
|
||||||
void tr_torrentLock( const tr_torrent * );
|
void tr_torrentLock( const tr_torrent * session );
|
||||||
|
|
||||||
void tr_torrentUnlock( const tr_torrent * );
|
void tr_torrentUnlock( const tr_torrent * session );
|
||||||
|
|
||||||
int tr_torrentIsSeed( const tr_torrent * );
|
int tr_torrentIsSeed( const tr_torrent * session );
|
||||||
|
|
||||||
void tr_torrentChangeMyPort( tr_torrent * );
|
void tr_torrentChangeMyPort( tr_torrent * session );
|
||||||
|
|
||||||
int tr_torrentExists( const tr_handle *,
|
int tr_torrentExists( const tr_session * session,
|
||||||
const uint8_t * );
|
const uint8_t * hash );
|
||||||
|
|
||||||
tr_torrent* tr_torrentFindFromId( tr_handle *,
|
tr_torrent* tr_torrentFindFromId( tr_session * session,
|
||||||
int id );
|
int id );
|
||||||
|
|
||||||
tr_torrent* tr_torrentFindFromHash( tr_handle *,
|
tr_torrent* tr_torrentFindFromHash( tr_session * session,
|
||||||
const uint8_t * );
|
const uint8_t * hash );
|
||||||
|
|
||||||
tr_torrent* tr_torrentFindFromHashString(
|
tr_torrent* tr_torrentFindFromHashString( tr_session * session,
|
||||||
tr_handle *,
|
const char * hashString );
|
||||||
const char * );
|
|
||||||
|
|
||||||
tr_torrent* tr_torrentFindFromObfuscatedHash(
|
tr_torrent* tr_torrentFindFromObfuscatedHash( tr_session * session,
|
||||||
tr_handle *,
|
const uint8_t * hash );
|
||||||
const
|
|
||||||
uint8_t* );
|
|
||||||
|
|
||||||
int tr_torrentAllowsPex( const tr_torrent * );
|
int tr_torrentAllowsPex( const tr_torrent * );
|
||||||
|
|
||||||
|
@ -153,7 +150,7 @@ tr_verify_state;
|
||||||
|
|
||||||
struct tr_torrent
|
struct tr_torrent
|
||||||
{
|
{
|
||||||
tr_handle * handle;
|
tr_session * session;
|
||||||
tr_info info;
|
tr_info info;
|
||||||
|
|
||||||
int uploadLimit;
|
int uploadLimit;
|
||||||
|
|
|
@ -913,11 +913,11 @@ tr_trackerNew( const tr_torrent * torrent )
|
||||||
const tr_info * info = &torrent->info;
|
const tr_info * info = &torrent->info;
|
||||||
tr_tracker * t;
|
tr_tracker * t;
|
||||||
|
|
||||||
ensureGlobalsExist( torrent->handle );
|
ensureGlobalsExist( torrent->session );
|
||||||
|
|
||||||
t = tr_new0( tr_tracker, 1 );
|
t = tr_new0( tr_tracker, 1 );
|
||||||
t->publisher = tr_publisherNew( );
|
t->publisher = tr_publisherNew( );
|
||||||
t->session = torrent->handle;
|
t->session = torrent->session;
|
||||||
t->scrapeIntervalSec = DEFAULT_SCRAPE_INTERVAL_SEC;
|
t->scrapeIntervalSec = DEFAULT_SCRAPE_INTERVAL_SEC;
|
||||||
t->retryScrapeIntervalSec = FIRST_SCRAPE_RETRY_INTERVAL_SEC;
|
t->retryScrapeIntervalSec = FIRST_SCRAPE_RETRY_INTERVAL_SEC;
|
||||||
t->retryAnnounceIntervalSec = FIRST_ANNOUNCE_RETRY_INTERVAL_SEC;
|
t->retryAnnounceIntervalSec = FIRST_ANNOUNCE_RETRY_INTERVAL_SEC;
|
||||||
|
|
|
@ -300,7 +300,7 @@ requestNextChunk( tr_webseed * w )
|
||||||
left, and we're asking for %lu this time\n", range, (unsigned
|
left, and we're asking for %lu this time\n", range, (unsigned
|
||||||
long)tr_torPieceCountBytes(w->torrent,piece), (unsigned long)have, (unsigned
|
long)tr_torPieceCountBytes(w->torrent,piece), (unsigned long)have, (unsigned
|
||||||
long)left, (unsigned long)thisPass );*/
|
long)left, (unsigned long)thisPass );*/
|
||||||
tr_webRun( w->torrent->handle, url, range, webResponseFunc, w );
|
tr_webRun( w->torrent->session, url, range, webResponseFunc, w );
|
||||||
tr_free( range );
|
tr_free( range );
|
||||||
tr_free( url );
|
tr_free( url );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue