mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
(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:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user