mirror of https://github.com/aria2/aria2
2009-06-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added uploadLength and numSeeders to the response of tellStatus xml-rpc method. Assert that PeerStorage instance is not null instead of checking if statement. It should be non-null in this context. * src/XmlRpcMethodImpl.ccpull/1/head
parent
f36ef2d26d
commit
9d910c47c2
|
@ -1,3 +1,11 @@
|
||||||
|
2009-06-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Added uploadLength and numSeeders to the response of tellStatus
|
||||||
|
xml-rpc method. Assert that PeerStorage instance is not null
|
||||||
|
instead of checking if statement. It should be non-null in this
|
||||||
|
context.
|
||||||
|
* src/XmlRpcMethodImpl.cc
|
||||||
|
|
||||||
2009-06-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-06-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Use htmlEscape instead of xmlEscape. Removed static function xmlEscape.
|
Use htmlEscape instead of xmlEscape. Removed static function xmlEscape.
|
||||||
|
|
|
@ -265,6 +265,7 @@ static void gatherProgressCommon
|
||||||
TransferStat stat = group->calculateStat();
|
TransferStat stat = group->calculateStat();
|
||||||
entryDict["downloadSpeed"] = Util::uitos(stat.getDownloadSpeed());
|
entryDict["downloadSpeed"] = Util::uitos(stat.getDownloadSpeed());
|
||||||
entryDict["uploadSpeed"] = Util::uitos(stat.getUploadSpeed());
|
entryDict["uploadSpeed"] = Util::uitos(stat.getUploadSpeed());
|
||||||
|
entryDict["uploadLength"] = Util::uitos(stat.getAllTimeUploadLength());
|
||||||
entryDict["connections"] = Util::uitos(group->getNumConnection());
|
entryDict["connections"] = Util::uitos(group->getNumConnection());
|
||||||
SharedHandle<PieceStorage> ps = group->getPieceStorage();
|
SharedHandle<PieceStorage> ps = group->getPieceStorage();
|
||||||
if(!ps.isNull()) {
|
if(!ps.isNull()) {
|
||||||
|
@ -281,9 +282,20 @@ static void gatherProgressCommon
|
||||||
|
|
||||||
#ifdef ENABLE_BITTORRENT
|
#ifdef ENABLE_BITTORRENT
|
||||||
static void gatherProgressBitTorrent
|
static void gatherProgressBitTorrent
|
||||||
(BDE& entryDict, const SharedHandle<BtContext>& btctx)
|
(BDE& entryDict, const SharedHandle<BtContext>& btctx,
|
||||||
|
const SharedHandle<BtRegistry>& btreg)
|
||||||
{
|
{
|
||||||
entryDict["infoHash"] = btctx->getInfoHashAsString();
|
entryDict["infoHash"] = btctx->getInfoHashAsString();
|
||||||
|
|
||||||
|
SharedHandle<PeerStorage> peerStorage =
|
||||||
|
btreg->getPeerStorage(btctx->getInfoHashAsString());
|
||||||
|
assert(!peerStorage.isNull());
|
||||||
|
|
||||||
|
std::deque<SharedHandle<Peer> > peers;
|
||||||
|
peerStorage->getActivePeers(peers);
|
||||||
|
entryDict["numSeeders"] =
|
||||||
|
Util::uitos(std::count_if(peers.begin(), peers.end(),
|
||||||
|
mem_fun_sh(&Peer::isSeeder)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gatherPeer(BDE& peers, const SharedHandle<PeerStorage>& ps)
|
static void gatherPeer(BDE& peers, const SharedHandle<PeerStorage>& ps)
|
||||||
|
@ -318,7 +330,8 @@ static void gatherProgress
|
||||||
SharedHandle<BtContext> btctx =
|
SharedHandle<BtContext> btctx =
|
||||||
dynamic_pointer_cast<BtContext>(group->getDownloadContext());
|
dynamic_pointer_cast<BtContext>(group->getDownloadContext());
|
||||||
if(!btctx.isNull()) {
|
if(!btctx.isNull()) {
|
||||||
gatherProgressBitTorrent(entryDict, btctx);
|
SharedHandle<BtRegistry> btreg = e->getBtRegistry();
|
||||||
|
gatherProgressBitTorrent(entryDict, btctx, btreg);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_BITTORRENT
|
#endif // ENABLE_BITTORRENT
|
||||||
}
|
}
|
||||||
|
@ -444,12 +457,11 @@ BDE GetPeersXmlRpcMethod::process
|
||||||
dynamic_pointer_cast<BtContext>(group->getDownloadContext());
|
dynamic_pointer_cast<BtContext>(group->getDownloadContext());
|
||||||
if(!btctx.isNull()) {
|
if(!btctx.isNull()) {
|
||||||
SharedHandle<BtRegistry> btreg = e->getBtRegistry();
|
SharedHandle<BtRegistry> btreg = e->getBtRegistry();
|
||||||
SharedHandle<PeerStorage> ps =
|
SharedHandle<PeerStorage> peerStorage =
|
||||||
btreg->getPeerStorage(btctx->getInfoHashAsString());
|
btreg->getPeerStorage(btctx->getInfoHashAsString());
|
||||||
if(!ps.isNull()) {
|
assert(!peerStorage.isNull());
|
||||||
BDE entry = BDE::dict();
|
BDE entry = BDE::dict();
|
||||||
gatherPeer(peers, ps);
|
gatherPeer(peers, peerStorage);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return peers;
|
return peers;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue