(trunk libT) when an rpc message torrent-stop or torrent-start comes in, check the torrent's currnet run state first instead of unconditionally calling tr_torrentStart() and tr_torrentStop()

This commit is contained in:
Charles Kerr 2010-02-21 23:03:29 +00:00
parent 27a64c18db
commit c23044ee86
1 changed files with 10 additions and 4 deletions

View File

@ -193,8 +193,11 @@ torrentStart( tr_session * session,
for( i = 0; i < torrentCount; ++i )
{
tr_torrent * tor = torrents[i];
tr_torrentStart( tor );
notify( session, TR_RPC_TORRENT_STARTED, tor );
if( !tor->isRunning )
{
tr_torrentStart( tor );
notify( session, TR_RPC_TORRENT_STARTED, tor );
}
}
tr_free( torrents );
return NULL;
@ -214,8 +217,11 @@ torrentStop( tr_session * session,
for( i = 0; i < torrentCount; ++i )
{
tr_torrent * tor = torrents[i];
tr_torrentStop( tor );
notify( session, TR_RPC_TORRENT_STOPPED, tor );
if( tor->isRunning )
{
tr_torrentStop( tor );
notify( session, TR_RPC_TORRENT_STOPPED, tor );
}
}
tr_free( torrents );
return NULL;