From 30c47d3b6fc4435731f7a7395a281457738d3ee0 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 13 Jan 2009 04:43:38 +0000 Subject: [PATCH] (trunk libT) #1655: rpc-spec 4.2: "session-stats" returns a new object instead of the response arguments --- libtransmission/rpcimpl.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/libtransmission/rpcimpl.c b/libtransmission/rpcimpl.c index 199421e1b..b50f1b0e5 100644 --- a/libtransmission/rpcimpl.c +++ b/libtransmission/rpcimpl.c @@ -687,25 +687,21 @@ sessionStats( tr_session * session, tr_benc * args_in UNUSED, tr_benc * args_out ) { - tr_benc * d; - tr_torrent * tor; - int running; - int total; + int running = 0; + int total = 0; + tr_torrent * tor = NULL; - tor = NULL; - total = running = 0; while(( tor = tr_torrentNext( session, tor ))) { ++total; if( tor->isRunning ) ++running; } - d = tr_bencDictAddDict( args_out, "session-stats", 5 ); - tr_bencDictAddInt( d, "activeTorrentCount", running ); - tr_bencDictAddInt( d, "downloadSpeed", (int)( tr_sessionGetPieceSpeed( session, TR_DOWN ) * 1024 ) ); - tr_bencDictAddInt( d, "pausedTorrentCount", total - running ); - tr_bencDictAddInt( d, "torrentCount", total ); - tr_bencDictAddInt( d, "uploadSpeed", (int)( tr_sessionGetPieceSpeed( session, TR_UP ) * 1024 ) ); + tr_bencDictAddInt( args_out, "activeTorrentCount", running ); + tr_bencDictAddInt( args_out, "downloadSpeed", (int)( tr_sessionGetPieceSpeed( session, TR_DOWN ) * 1024 ) ); + tr_bencDictAddInt( args_out, "pausedTorrentCount", total - running ); + tr_bencDictAddInt( args_out, "torrentCount", total ); + tr_bencDictAddInt( args_out, "uploadSpeed", (int)( tr_sessionGetPieceSpeed( session, TR_UP ) * 1024 ) ); return NULL; } -- 2.40.0