aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-04-07 19:31:13 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2013-04-07 19:31:13 +0200
commit86648a8d16699ab392508a48bb867d3fc4f7d6cf (patch)
tree8791097b76870c494c545a036368c5673ae48efe /src/net.cpp
parent6ed71b5e4faa2ea6d739eefa9c3dcc15db80439c (diff)
Add bytessent, bytesrecv and syncnode to getpeerinfo
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 4727f1e2e6..ccacb0b291 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -619,6 +619,9 @@ void CNode::copyStats(CNodeStats &stats)
X(nReleaseTime);
X(nStartingHeight);
X(nMisbehavior);
+ X(nSendBytes);
+ X(nRecvBytes);
+ stats.fSyncNode = (this == pnodeSync);
}
#undef X
@@ -713,6 +716,7 @@ void SocketSendData(CNode *pnode)
int nBytes = send(pnode->hSocket, &data[pnode->nSendOffset], data.size() - pnode->nSendOffset, MSG_NOSIGNAL | MSG_DONTWAIT);
if (nBytes > 0) {
pnode->nLastSend = GetTime();
+ pnode->nSendBytes += nBytes;
pnode->nSendOffset += nBytes;
if (pnode->nSendOffset == data.size()) {
pnode->nSendOffset = 0;
@@ -976,6 +980,7 @@ void ThreadSocketHandler()
if (!pnode->ReceiveMsgBytes(pchBuf, nBytes))
pnode->CloseSocketDisconnect();
pnode->nLastRecv = GetTime();
+ pnode->nRecvBytes += nBytes;
}
else if (nBytes == 0)
{