Skip to content

Commit fa6d5a2

Browse files
author
MarcoFalke
committed
scripted-diff: Rename m_last_send and m_last_recv
-BEGIN VERIFY SCRIPT- ren() { sed -i "s/\<$1\>/$2/g" $(git grep -l "$1" ./src) ; } ren nLastSend m_last_send ren nLastRecv m_last_recv -END VERIFY SCRIPT-
1 parent 398fd63 commit fa6d5a2

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/net.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,8 @@ void CNode::CopyStats(CNodeStats& stats)
585585
} else {
586586
stats.fRelayTxes = false;
587587
}
588-
X(nLastSend);
589-
X(nLastRecv);
588+
X(m_last_send);
589+
X(m_last_recv);
590590
X(nLastTXTime);
591591
X(nLastBlockTime);
592592
X(nTimeConnected);
@@ -633,7 +633,7 @@ bool CNode::ReceiveMsgBytes(Span<const uint8_t> msg_bytes, bool& complete)
633633
complete = false;
634634
const auto time = GetTime<std::chrono::microseconds>();
635635
LOCK(cs_vRecv);
636-
nLastRecv = std::chrono::duration_cast<std::chrono::seconds>(time).count();
636+
m_last_recv = std::chrono::duration_cast<std::chrono::seconds>(time).count();
637637
nRecvBytes += msg_bytes.size();
638638
while (msg_bytes.size() > 0) {
639639
// absorb network data
@@ -804,7 +804,7 @@ size_t CConnman::SocketSendData(CNode& node) const
804804
nBytes = send(node.hSocket, reinterpret_cast<const char*>(data.data()) + node.nSendOffset, data.size() - node.nSendOffset, MSG_NOSIGNAL | MSG_DONTWAIT);
805805
}
806806
if (nBytes > 0) {
807-
node.nLastSend = GetTimeSeconds();
807+
node.m_last_send = GetTimeSeconds();
808808
node.nSendBytes += nBytes;
809809
node.nSendOffset += nBytes;
810810
nSentSize += nBytes;
@@ -1330,18 +1330,18 @@ bool CConnman::InactivityCheck(const CNode& node) const
13301330

13311331
if (!ShouldRunInactivityChecks(node, now)) return false;
13321332

1333-
if (node.nLastRecv == 0 || node.nLastSend == 0) {
1334-
LogPrint(BCLog::NET, "socket no message in first %i seconds, %d %d peer=%d\n", m_peer_connect_timeout, node.nLastRecv != 0, node.nLastSend != 0, node.GetId());
1333+
if (node.m_last_recv == 0 || node.m_last_send == 0) {
1334+
LogPrint(BCLog::NET, "socket no message in first %i seconds, %d %d peer=%d\n", m_peer_connect_timeout, node.m_last_recv != 0, node.m_last_send != 0, node.GetId());
13351335
return true;
13361336
}
13371337

1338-
if (now > node.nLastSend + TIMEOUT_INTERVAL) {
1339-
LogPrint(BCLog::NET, "socket sending timeout: %is peer=%d\n", now - node.nLastSend, node.GetId());
1338+
if (now > node.m_last_send + TIMEOUT_INTERVAL) {
1339+
LogPrint(BCLog::NET, "socket sending timeout: %is peer=%d\n", now - node.m_last_send, node.GetId());
13401340
return true;
13411341
}
13421342

1343-
if (now > node.nLastRecv + TIMEOUT_INTERVAL) {
1344-
LogPrint(BCLog::NET, "socket receive timeout: %is peer=%d\n", now - node.nLastRecv, node.GetId());
1343+
if (now > node.m_last_recv + TIMEOUT_INTERVAL) {
1344+
LogPrint(BCLog::NET, "socket receive timeout: %is peer=%d\n", now - node.m_last_recv, node.GetId());
13451345
return true;
13461346
}
13471347

src/net.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ class CNodeStats
241241
NodeId nodeid;
242242
ServiceFlags nServices;
243243
bool fRelayTxes;
244-
int64_t nLastSend;
245-
int64_t nLastRecv;
244+
int64_t m_last_send;
245+
int64_t m_last_recv;
246246
int64_t nLastTXTime;
247247
int64_t nLastBlockTime;
248248
int64_t nTimeConnected;
@@ -420,8 +420,8 @@ class CNode
420420

421421
uint64_t nRecvBytes GUARDED_BY(cs_vRecv){0};
422422

423-
std::atomic<int64_t> nLastSend{0};
424-
std::atomic<int64_t> nLastRecv{0};
423+
std::atomic<int64_t> m_last_send{0};
424+
std::atomic<int64_t> m_last_recv{0};
425425
//! Unix epoch time at peer connection, in seconds.
426426
const int64_t nTimeConnected;
427427
std::atomic<int64_t> nTimeOffset{0};

src/qt/rpcconsole.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,8 +1172,8 @@ void RPCConsole::updateDetailWidget()
11721172
ui->peerConnTime->setText(GUIUtil::formatDurationStr(time_now - stats->nodeStats.nTimeConnected));
11731173
ui->peerLastBlock->setText(TimeDurationField(time_now, stats->nodeStats.nLastBlockTime));
11741174
ui->peerLastTx->setText(TimeDurationField(time_now, stats->nodeStats.nLastTXTime));
1175-
ui->peerLastSend->setText(TimeDurationField(time_now, stats->nodeStats.nLastSend));
1176-
ui->peerLastRecv->setText(TimeDurationField(time_now, stats->nodeStats.nLastRecv));
1175+
ui->peerLastSend->setText(TimeDurationField(time_now, stats->nodeStats.m_last_send));
1176+
ui->peerLastRecv->setText(TimeDurationField(time_now, stats->nodeStats.m_last_recv));
11771177
ui->peerBytesSent->setText(GUIUtil::formatBytes(stats->nodeStats.nSendBytes));
11781178
ui->peerBytesRecv->setText(GUIUtil::formatBytes(stats->nodeStats.nRecvBytes));
11791179
ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.m_last_ping_time));

src/rpc/net.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ static RPCHelpMan getpeerinfo()
211211
obj.pushKV("services", strprintf("%016x", stats.nServices));
212212
obj.pushKV("servicesnames", GetServicesNames(stats.nServices));
213213
obj.pushKV("relaytxes", stats.fRelayTxes);
214-
obj.pushKV("lastsend", stats.nLastSend);
215-
obj.pushKV("lastrecv", stats.nLastRecv);
214+
obj.pushKV("lastsend", stats.m_last_send);
215+
obj.pushKV("lastrecv", stats.m_last_recv);
216216
obj.pushKV("last_transaction", stats.nLastTXTime);
217217
obj.pushKV("last_block", stats.nLastBlockTime);
218218
obj.pushKV("bytessent", stats.nSendBytes);

0 commit comments

Comments
 (0)