Add a callback to be invoked when the queue starts a torrent.
This commit is contained in:
parent
52487018ed
commit
ce77935009
|
@ -3572,8 +3572,11 @@ queuePulse( tr_session * session, tr_direction dir )
|
|||
const int n = tr_sessionCountQueueFreeSlots( session, dir );
|
||||
for( i=0; i<n; i++ ) {
|
||||
tr_torrent * tor = tr_sessionGetNextQueuedTorrent( session, dir );
|
||||
if( tor != NULL )
|
||||
if( tor != NULL ) {
|
||||
tr_torrentStartNow( tor );
|
||||
if( tor->queue_started_callback != NULL )
|
||||
(*tor->queue_started_callback)( tor );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3321,3 +3321,11 @@ torrentSetQueued( tr_torrent * tor, bool queued )
|
|||
tor->anyDate = tr_time( );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tr_torrentSetQueueStartCallback( tr_torrent * torrent, void (*callback)( tr_torrent * ) )
|
||||
{
|
||||
torrent->queue_started_callback = callback;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -236,6 +236,8 @@ struct tr_torrent
|
|||
tr_torrent_idle_limit_hit_func * idle_limit_hit_func;
|
||||
void * idle_limit_hit_func_user_data;
|
||||
|
||||
void ( * queue_started_callback )( tr_torrent * );
|
||||
|
||||
bool isRunning;
|
||||
bool isStopping;
|
||||
bool isDeleting;
|
||||
|
|
|
@ -808,6 +808,9 @@ void tr_sessionSetQueueStalledMinutes( tr_session *, int minutes );
|
|||
/** @return the number of minutes a torrent can be idle before being considered as stalled */
|
||||
int tr_sessionGetQueueStalledMinutes( const tr_session * );
|
||||
|
||||
/** @brief Set a callback that is invoked when the queue starts a torrent */
|
||||
void tr_torrentSetQueueStartCallback( tr_torrent * torrent, void (*callback)( tr_torrent * ) );
|
||||
|
||||
|
||||
/***
|
||||
****
|
||||
|
|
Loading…
Reference in New Issue