diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-02-03 22:19:28 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-02-03 22:21:37 +0900 |
| commit | 25615fcb1744e94f4774aaee24ed4db172af397f (patch) | |
| tree | 57208721c3891951745ce543a9c83f4bfe2ce748 /src/RpcMethodImpl.cc | |
| parent | dbcf07fd11b9b29494787dd54fb29c5644798ec3 (diff) | |
Add "seeder" key to tellStatus RPC response
Diffstat (limited to 'src/RpcMethodImpl.cc')
| -rw-r--r-- | src/RpcMethodImpl.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/RpcMethodImpl.cc b/src/RpcMethodImpl.cc index 0f87a948..7cded6ab 100644 --- a/src/RpcMethodImpl.cc +++ b/src/RpcMethodImpl.cc @@ -710,7 +710,9 @@ void gatherBitTorrentMetadata(Dict* btDict, TorrentAttribute* torrentAttrs) } namespace { -void gatherProgressBitTorrent(Dict* entryDict, TorrentAttribute* torrentAttrs, +void gatherProgressBitTorrent(Dict* entryDict, + const std::shared_ptr<RequestGroup>& group, + TorrentAttribute* torrentAttrs, BtObject* btObject, const std::vector<std::string>& keys) { @@ -734,6 +736,9 @@ void gatherProgressBitTorrent(Dict* entryDict, TorrentAttribute* torrentAttrs, util::uitos(countSeeder(peers.begin(), peers.end()))); } } + if (requested_key(keys, KEY_SEEDER)) { + entryDict->put(KEY_SEEDER, group->isSeeder() ? VLB_TRUE : VLB_FALSE); + } } } // namespace @@ -777,9 +782,9 @@ void gatherProgress(Dict* entryDict, const std::shared_ptr<RequestGroup>& group, gatherProgressCommon(entryDict, group, keys); #ifdef ENABLE_BITTORRENT if (group->getDownloadContext()->hasAttribute(CTX_ATTR_BT)) { - gatherProgressBitTorrent( - entryDict, bittorrent::getTorrentAttrs(group->getDownloadContext()), - e->getBtRegistry()->get(group->getGID()), keys); + gatherProgressBitTorrent(entryDict, group, bittorrent::getTorrentAttrs( + group->getDownloadContext()), + e->getBtRegistry()->get(group->getGID()), keys); } #endif // ENABLE_BITTORRENT } |
