(trunk, libT) #5450: when starting torrents via RPC with torrent-start or torrent-start-now requests, work through the rpc-supplied torrent list in queue order

This commit is contained in:
Jordan Lee
2013-10-20 17:24:57 +00:00
parent 451d398aa6
commit cd00ad4f55

View File

@@ -253,6 +253,15 @@ queueMoveBottom (tr_session * session,
return NULL;
}
static int
compareTorrentByQueuePosition (const void * va, const void * vb)
{
const tr_torrent * a = * (const tr_torrent **) va;
const tr_torrent * b = * (const tr_torrent **) vb;
return a->queuePosition - b->queuePosition;
}
static const char*
torrentStart (tr_session * session,
tr_variant * args_in,
@@ -266,6 +275,7 @@ torrentStart (tr_session * session,
assert (idle_data == NULL);
torrents = getTorrents (session, args_in, &torrentCount);
qsort (torrents, torrentCount, sizeof (tr_torrent *), compareTorrentByQueuePosition);
for (i=0; i<torrentCount; ++i)
{
tr_torrent * tor = torrents[i];
@@ -293,6 +303,7 @@ torrentStartNow (tr_session * session,
assert (idle_data == NULL);
torrents = getTorrents (session, args_in, &torrentCount);
qsort (torrents, torrentCount, sizeof (tr_torrent *), compareTorrentByQueuePosition);
for (i=0; i<torrentCount; ++i)
{
tr_torrent * tor = torrents[i];