mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-09 06:18:02 +00:00
Merge branch 'dryabov-libtorrent-status'
This commit is contained in:
commit
5379d2a7de
@ -99,6 +99,10 @@ Value getinfo(const Array& params, bool fHelp)
|
|||||||
obj.push_back(Pair("public_server_mode", GetBoolArg("-public_server_mode",false)));
|
obj.push_back(Pair("public_server_mode", GetBoolArg("-public_server_mode",false)));
|
||||||
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Object torrent_stats = getLibtorrentSessionStatus();
|
||||||
|
obj.insert( obj.end(), torrent_stats.begin(), torrent_stats.end() );
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2889,3 +2889,37 @@ Value search(const Array& params, bool fHelp)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Object getLibtorrentSessionStatus()
|
||||||
|
{
|
||||||
|
Object obj;
|
||||||
|
boost::shared_ptr<session> ses(m_ses);
|
||||||
|
if( ses ) {
|
||||||
|
session_status stats = ses->status();
|
||||||
|
|
||||||
|
obj.push_back( Pair("dht_torrents", stats.dht_torrents) );
|
||||||
|
obj.push_back( Pair("num_peers", stats.num_peers) );
|
||||||
|
obj.push_back( Pair("peerlist_size", stats.peerlist_size) );
|
||||||
|
obj.push_back( Pair("num_active_requests", (int)stats.active_requests.size()) );
|
||||||
|
|
||||||
|
obj.push_back( Pair("download_rate", stats.download_rate) );
|
||||||
|
obj.push_back( Pair("upload_rate", stats.upload_rate) );
|
||||||
|
obj.push_back( Pair("dht_download_rate", stats.dht_download_rate) );
|
||||||
|
obj.push_back( Pair("dht_upload_rate", stats.dht_upload_rate) );
|
||||||
|
obj.push_back( Pair("ip_overhead_download_rate", stats.ip_overhead_download_rate) );
|
||||||
|
obj.push_back( Pair("ip_overhead_upload_rate", stats.ip_overhead_upload_rate) );
|
||||||
|
obj.push_back( Pair("payload_download_rate", stats.payload_download_rate) );
|
||||||
|
obj.push_back( Pair("payload_upload_rate", stats.payload_upload_rate) );
|
||||||
|
|
||||||
|
obj.push_back( Pair("total_download", stats.total_download) );
|
||||||
|
obj.push_back( Pair("total_upload", stats.total_upload) );
|
||||||
|
obj.push_back( Pair("total_dht_download", stats.total_dht_download) );
|
||||||
|
obj.push_back( Pair("total_dht_upload", stats.total_dht_upload) );
|
||||||
|
obj.push_back( Pair("total_ip_overhead_download", stats.total_ip_overhead_download) );
|
||||||
|
obj.push_back( Pair("total_ip_overhead_upload", stats.total_ip_overhead_upload) );
|
||||||
|
obj.push_back( Pair("total_payload_download", stats.total_payload_download) );
|
||||||
|
obj.push_back( Pair("total_payload_upload", stats.total_payload_upload) );
|
||||||
|
}
|
||||||
|
// @TODO: Is there a way to get some statistics for dhtProxy?
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
#include "json/json_spirit.h"
|
||||||
|
|
||||||
#define LIBTORRENT_PORT_OFFSET 1000
|
#define LIBTORRENT_PORT_OFFSET 1000
|
||||||
|
|
||||||
@ -53,4 +54,6 @@ void dhtPutData(std::string const &username, std::string const &resource, bool m
|
|||||||
void dhtPutDataSigned(std::string const &username, std::string const &resource, bool multi,
|
void dhtPutDataSigned(std::string const &username, std::string const &resource, bool multi,
|
||||||
libtorrent::entry const &p, std::string const &sig_p, std::string const &sig_user, bool local);
|
libtorrent::entry const &p, std::string const &sig_p, std::string const &sig_user, bool local);
|
||||||
|
|
||||||
|
json_spirit::Object getLibtorrentSessionStatus();
|
||||||
|
|
||||||
#endif // TWISTER_H
|
#endif // TWISTER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user