mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 04:12:36 -03:00
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:
parent
6693c499f7
commit
60441a3432
2 changed files with 16 additions and 16 deletions
22
src/net.cpp
22
src/net.cpp
|
@ -2797,7 +2797,7 @@ CNode::CNode(NodeId idIn,
|
||||||
|
|
||||||
void CNode::MarkReceivedMsgsForProcessing(unsigned int recv_flood_size)
|
void CNode::MarkReceivedMsgsForProcessing(unsigned int recv_flood_size)
|
||||||
{
|
{
|
||||||
AssertLockNotHeld(cs_vProcessMsg);
|
AssertLockNotHeld(m_msg_process_queue_mutex);
|
||||||
|
|
||||||
size_t nSizeAdded = 0;
|
size_t nSizeAdded = 0;
|
||||||
for (const auto& msg : vRecvMsg) {
|
for (const auto& msg : vRecvMsg) {
|
||||||
|
@ -2806,24 +2806,24 @@ void CNode::MarkReceivedMsgsForProcessing(unsigned int recv_flood_size)
|
||||||
nSizeAdded += msg.m_raw_message_size;
|
nSizeAdded += msg.m_raw_message_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCK(cs_vProcessMsg);
|
LOCK(m_msg_process_queue_mutex);
|
||||||
vProcessMsg.splice(vProcessMsg.end(), vRecvMsg);
|
m_msg_process_queue.splice(m_msg_process_queue.end(), vRecvMsg);
|
||||||
nProcessQueueSize += nSizeAdded;
|
m_msg_process_queue_size += nSizeAdded;
|
||||||
fPauseRecv = nProcessQueueSize > recv_flood_size;
|
fPauseRecv = m_msg_process_queue_size > recv_flood_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::pair<CNetMessage, bool>> CNode::PollMessage(size_t recv_flood_size)
|
std::optional<std::pair<CNetMessage, bool>> CNode::PollMessage(size_t recv_flood_size)
|
||||||
{
|
{
|
||||||
LOCK(cs_vProcessMsg);
|
LOCK(m_msg_process_queue_mutex);
|
||||||
if (vProcessMsg.empty()) return std::nullopt;
|
if (m_msg_process_queue.empty()) return std::nullopt;
|
||||||
|
|
||||||
std::list<CNetMessage> msgs;
|
std::list<CNetMessage> msgs;
|
||||||
// Just take one message
|
// Just take one message
|
||||||
msgs.splice(msgs.begin(), vProcessMsg, vProcessMsg.begin());
|
msgs.splice(msgs.begin(), m_msg_process_queue, m_msg_process_queue.begin());
|
||||||
nProcessQueueSize -= msgs.front().m_raw_message_size;
|
m_msg_process_queue_size -= msgs.front().m_raw_message_size;
|
||||||
fPauseRecv = nProcessQueueSize > recv_flood_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)
|
bool CConnman::NodeFullyConnected(const CNode* pnode)
|
||||||
|
|
10
src/net.h
10
src/net.h
|
@ -420,7 +420,7 @@ public:
|
||||||
|
|
||||||
/** Move all messages from the received queue to the processing queue. */
|
/** Move all messages from the received queue to the processing queue. */
|
||||||
void MarkReceivedMsgsForProcessing(unsigned int recv_flood_size)
|
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.
|
/** 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
|
* consisting of the message and a bool that indicates if the processing
|
||||||
* queue has more entries. */
|
* queue has more entries. */
|
||||||
std::optional<std::pair<CNetMessage, bool>> PollMessage(size_t recv_flood_size)
|
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 {
|
bool IsOutboundOrBlockRelayConn() const {
|
||||||
switch (m_conn_type) {
|
switch (m_conn_type) {
|
||||||
|
@ -615,9 +615,9 @@ private:
|
||||||
|
|
||||||
std::list<CNetMessage> vRecvMsg; // Used only by SocketHandler thread
|
std::list<CNetMessage> vRecvMsg; // Used only by SocketHandler thread
|
||||||
|
|
||||||
Mutex cs_vProcessMsg;
|
Mutex m_msg_process_queue_mutex;
|
||||||
std::list<CNetMessage> vProcessMsg GUARDED_BY(cs_vProcessMsg);
|
std::list<CNetMessage> m_msg_process_queue GUARDED_BY(m_msg_process_queue_mutex);
|
||||||
size_t nProcessQueueSize GUARDED_BY(cs_vProcessMsg){0};
|
size_t m_msg_process_queue_size GUARDED_BY(m_msg_process_queue_mutex){0};
|
||||||
|
|
||||||
// Our address, as reported by the peer
|
// Our address, as reported by the peer
|
||||||
CService addrLocal GUARDED_BY(m_addr_local_mutex);
|
CService addrLocal GUARDED_BY(m_addr_local_mutex);
|
||||||
|
|
Loading…
Reference in a new issue