X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Frpcnet.cpp;h=3b283d9db28bcdfe52e3ad1aad623848d8b36603;hb=77a43545b4491b9703d803765da9059d2bdd5aaa;hp=ecc4331d0a26b8706765dc6a841fc7aaf9ee8bff;hpb=8de38355024dfd223507471a54a66793e1245f63;p=novacoin.git diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index ecc4331..3b283d9 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -2,12 +2,12 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "net.h" #include "bitcoinrpc.h" #include "alert.h" #include "wallet.h" #include "db.h" #include "walletdb.h" +#include "net.h" using namespace json_spirit; using namespace std; @@ -52,7 +52,7 @@ Value getpeerinfo(const Array& params, bool fHelp) Object obj; obj.push_back(Pair("addr", stats.addrName)); - obj.push_back(Pair("services", strprintf("%08"PRI64x, stats.nServices))); + obj.push_back(Pair("services", strprintf("%08" PRIx64, stats.nServices))); obj.push_back(Pair("lastsend", (boost::int64_t)stats.nLastSend)); obj.push_back(Pair("lastrecv", (boost::int64_t)stats.nLastRecv)); obj.push_back(Pair("bytessent", (boost::int64_t)stats.nSendBytes)); @@ -137,3 +137,18 @@ Value sendalert(const Array& params, bool fHelp) result.push_back(Pair("nCancel", alert.nCancel)); return result; } + +Value getnettotals(const Array& params, bool fHelp) +{ + if (fHelp || params.size() > 0) + throw runtime_error( + "getnettotals\n" + "Returns information about network traffic, including bytes in, bytes out,\n" + "and current time."); + + Object obj; + obj.push_back(Pair("totalbytesrecv", static_cast< boost::uint64_t>(CNode::GetTotalBytesRecv()))); + obj.push_back(Pair("totalbytessent", static_cast(CNode::GetTotalBytesSent()))); + obj.push_back(Pair("timemillis", static_cast(GetTimeMillis()))); + return obj; +} \ No newline at end of file