(trunk libT) minor torrent iteration cleanup. (wereHamster, charles)

This commit is contained in:
Charles Kerr 2009-01-13 16:51:38 +00:00
parent 417b7b2029
commit f945058de0
2 changed files with 5 additions and 15 deletions

View File

@ -165,8 +165,7 @@ bindCb( int * const socket,
static void
incomingPeersPulse( tr_shared * s )
{
int allPaused;
tr_torrent * tor;
tr_bool allPaused;
if( s->shouldChange )
{
@ -176,17 +175,7 @@ incomingPeersPulse( tr_shared * s )
tr_socketListForEach( s->bindSockets, &bindCb, s );
}
/* see if any torrents aren't paused */
allPaused = 1;
tor = NULL;
while( ( tor = tr_torrentNext( s->session, tor ) ) )
{
if( TR_STATUS_IS_ACTIVE( tr_torrentGetActivity( tor ) ) )
{
allPaused = 0;
break;
}
}
allPaused = tr_sessionGetActiveTorrentCount( s->session ) == 0;
/* if we have any running torrents, check for new incoming peer connections */
/* (jhujhiti):

View File

@ -936,7 +936,8 @@ trackerPulse( void * vsession )
dbgmsg( NULL, "tracker pulse... %d running", th->runningCount );
/* upkeep: queue periodic rescrape / reannounce */
for( tor = session->torrentList; tor; tor = tor->next )
tor = NULL;
while(( tor = tr_torrentNext( session, tor )))
{
tr_tracker * t = tor->tracker;
@ -965,7 +966,7 @@ trackerPulse( void * vsession )
/* free the tracker manager if no torrents are left */
if( ( session->tracker )
&& ( session->tracker->runningCount < 1 )
&& ( session->torrentList == NULL ) )
&& ( tr_sessionCountTorrents( session ) == 0 ) )
{
tr_trackerSessionClose( session );
}