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 @@ -157,6 +157,12 @@ class Node
157157 // ! Get total bytes sent.
158158 virtual int64_t getTotalBytesSent () = 0;
159159
160+ // ! Set total bytes recv
161+ virtual void setTotalBytesRecv (uint64_t bytes) = 0;
162+
163+ // ! Set total bytes sent
164+ virtual void setTotalBytesSent (uint64_t bytes) = 0;
165+
160166 // ! Get mempool size.
161167 virtual size_t getMempoolSize () = 0;
162168
Original file line number Diff line number Diff line change @@ -3779,6 +3779,14 @@ uint64_t CConnman::GetTotalBytesSent() const
37793779 return nTotalBytesSent;
37803780}
37813781
3782+ void CConnman::SetTotalBytesRecv (uint64_t bytes) { nTotalBytesRecv.store (bytes); }
3783+
3784+ void CConnman::SetTotalBytesSent (uint64_t bytes)
3785+ {
3786+ WAIT_LOCK (m_total_bytes_sent_mutex, lock);
3787+ nTotalBytesSent = bytes;
3788+ }
3789+
37823790ServiceFlags CConnman::GetLocalServices () const
37833791{
37843792 return m_local_services;
Original file line number Diff line number Diff line change @@ -1261,6 +1261,8 @@ class CConnman
12611261
12621262 uint64_t GetTotalBytesRecv () const ;
12631263 uint64_t GetTotalBytesSent () const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex);
1264+ void SetTotalBytesRecv (uint64_t bytes);
1265+ void SetTotalBytesSent (uint64_t bytes);
12641266
12651267 /* * Get a unique deterministic randomizer. */
12661268 CSipHasher GetDeterministicRandomizer (uint64_t id) const ;
Original file line number Diff line number Diff line change @@ -285,6 +285,8 @@ class NodeImpl : public Node
285285 }
286286 int64_t getTotalBytesRecv () override { return m_context->connman ? m_context->connman ->GetTotalBytesRecv () : 0 ; }
287287 int64_t getTotalBytesSent () override { return m_context->connman ? m_context->connman ->GetTotalBytesSent () : 0 ; }
288+ void setTotalBytesRecv (uint64_t bytes) override { if (m_context->connman ) m_context->connman ->SetTotalBytesRecv (bytes); }
289+ void setTotalBytesSent (uint64_t bytes) override { if (m_context->connman ) m_context->connman ->SetTotalBytesSent (bytes); }
288290 size_t getMempoolSize () override { return m_context->mempool ? m_context->mempool ->size () : 0 ; }
289291 size_t getMempoolDynamicUsage () override { return m_context->mempool ? m_context->mempool ->DynamicMemoryUsage () : 0 ; }
290292 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