File tree Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,12 @@ class Node
160160
161161 virtual CTxMemPool& mempool () = 0;
162162
163+ // ! Set total bytes recv
164+ virtual void setTotalBytesRecv (uint64_t bytes) = 0;
165+
166+ // ! Set total bytes sent
167+ virtual void setTotalBytesSent (uint64_t bytes) = 0;
168+
163169 // ! Get mempool size.
164170 virtual size_t getMempoolSize () = 0;
165171
Original file line number Diff line number Diff line change @@ -3778,6 +3778,14 @@ uint64_t CConnman::GetTotalBytesSent() const
37783778 return nTotalBytesSent;
37793779}
37803780
3781+ void CConnman::SetTotalBytesRecv (uint64_t bytes) { nTotalBytesRecv.store (bytes); }
3782+
3783+ void CConnman::SetTotalBytesSent (uint64_t bytes) EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
3784+ {
3785+ WAIT_LOCK (m_total_bytes_sent_mutex, lock);
3786+ nTotalBytesSent = bytes;
3787+ }
3788+
37813789ServiceFlags CConnman::GetLocalServices () const
37823790{
37833791 return nLocalServices;
Original file line number Diff line number Diff line change @@ -1276,6 +1276,8 @@ class CConnman
12761276
12771277 uint64_t GetTotalBytesRecv () const ;
12781278 uint64_t GetTotalBytesSent () const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex);
1279+ void SetTotalBytesRecv (uint64_t bytes);
1280+ void SetTotalBytesSent (uint64_t bytes);
12791281
12801282 /* * Get a unique deterministic randomizer. */
12811283 CSipHasher GetDeterministicRandomizer (uint64_t id) const ;
Original file line number Diff line number Diff line change @@ -276,6 +276,8 @@ class NodeImpl : public Node
276276 }
277277 int64_t getTotalBytesRecv () override { return m_context->connman ? m_context->connman ->GetTotalBytesRecv () : 0 ; }
278278 int64_t getTotalBytesSent () override { return m_context->connman ? m_context->connman ->GetTotalBytesSent () : 0 ; }
279+ void setTotalBytesRecv (uint64_t bytes) override { if (m_context->connman ) m_context->connman ->SetTotalBytesRecv (bytes); }
280+ void setTotalBytesSent (uint64_t bytes) override { if (m_context->connman ) m_context->connman ->SetTotalBytesSent (bytes); }
279281 size_t getMempoolSize () override { return m_context->mempool ? m_context->mempool ->size () : 0 ; }
280282 size_t getMempoolDynamicUsage () override { return m_context->mempool ? m_context->mempool ->DynamicMemoryUsage () : 0 ; }
281283 size_t getMempoolMaxUsage () override { return m_context->mempool ? m_context->mempool ->m_opts .max_size_bytes : 0 ; }
You can’t perform that action at this time.
0 commit comments