scripted-diff: [net] Rename CNode process queue members

-BEGIN VERIFY SCRIPT-
ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ./src ./test); }

ren cs_vProcessMsg    m_msg_process_queue_mutex
ren vProcessMsg       m_msg_process_queue
ren nProcessQueueSize m_msg_process_queue_size

-END VERIFY SCRIPT-
This commit is contained in:
dergoegge 2023-03-14 18:24:58 +01:00
parent 6693c499f7
commit 60441a3432
2 changed files with 16 additions and 16 deletions

View file

@ -2797,7 +2797,7 @@ CNode::CNode(NodeId idIn,
void CNode::MarkReceivedMsgsForProcessing(unsigned int recv_flood_size)
{
AssertLockNotHeld(cs_vProcessMsg);
AssertLockNotHeld(m_msg_process_queue_mutex);
size_t nSizeAdded = 0;
for (const auto& msg : vRecvMsg) {
@ -2806,24 +2806,24 @@ void CNode::MarkReceivedMsgsForProcessing(unsigned int recv_flood_size)
nSizeAdded += msg.m_raw_message_size;
}
LOCK(cs_vProcessMsg);
vProcessMsg.splice(vProcessMsg.end(), vRecvMsg);
nProcessQueueSize += nSizeAdded;
fPauseRecv = nProcessQueueSize > recv_flood_size;
LOCK(m_msg_process_queue_mutex);
m_msg_process_queue.splice(m_msg_process_queue.end(), vRecvMsg);
m_msg_process_queue_size += nSizeAdded;
fPauseRecv = m_msg_process_queue_size > recv_flood_size;
}
std::optional<std::pair<CNetMessage, bool>> CNode::PollMessage(size_t recv_flood_size)
{
LOCK(cs_vProcessMsg);
if (vProcessMsg.empty()) return std::nullopt;
LOCK(m_msg_process_queue_mutex);
if (m_msg_process_queue.empty()) return std::nullopt;
std::list<CNetMessage> msgs;
// Just take one message
msgs.splice(msgs.begin(), vProcessMsg, vProcessMsg.begin());
nProcessQueueSize -= msgs.front().m_raw_message_size;
fPauseRecv = nProcessQueueSize > recv_flood_size;
msgs.splice(msgs.begin(), m_msg_process_queue, m_msg_process_queue.begin());
m_msg_process_queue_size -= msgs.front().m_raw_message_size;
fPauseRecv = m_msg_process_queue_size > recv_flood_size;
return std::make_pair(std::move(msgs.front()), !vProcessMsg.empty());
return std::make_pair(std::move(msgs.front()), !m_msg_process_queue.empty());
}
bool CConnman::NodeFullyConnected(const CNode* pnode)

View file

@ -420,7 +420,7 @@ public:
/** Move all messages from the received queue to the processing queue. */
void MarkReceivedMsgsForProcessing(unsigned int recv_flood_size)
EXCLUSIVE_LOCKS_REQUIRED(!cs_vProcessMsg);
EXCLUSIVE_LOCKS_REQUIRED(!m_msg_process_queue_mutex);
/** Poll the next message from the processing queue of this connection.
*
@ -428,7 +428,7 @@ public:
* consisting of the message and a bool that indicates if the processing
* queue has more entries. */
std::optional<std::pair<CNetMessage, bool>> PollMessage(size_t recv_flood_size)
EXCLUSIVE_LOCKS_REQUIRED(!cs_vProcessMsg);
EXCLUSIVE_LOCKS_REQUIRED(!m_msg_process_queue_mutex);
bool IsOutboundOrBlockRelayConn() const {
switch (m_conn_type) {
@ -615,9 +615,9 @@ private:
std::list<CNetMessage> vRecvMsg; // Used only by SocketHandler thread
Mutex cs_vProcessMsg;
std::list<CNetMessage> vProcessMsg GUARDED_BY(cs_vProcessMsg);
size_t nProcessQueueSize GUARDED_BY(cs_vProcessMsg){0};
Mutex m_msg_process_queue_mutex;
std::list<CNetMessage> m_msg_process_queue GUARDED_BY(m_msg_process_queue_mutex);
size_t m_msg_process_queue_size GUARDED_BY(m_msg_process_queue_mutex){0};
// Our address, as reported by the peer
CService addrLocal GUARDED_BY(m_addr_local_mutex);