net: Remove unused interrupt from SendMessages
This commit is contained in:
parent
88a15ebc8d
commit
c469ecf22e
5 changed files with 20 additions and 20 deletions
|
@ -2042,7 +2042,7 @@ void CConnman::ThreadMessageHandler()
|
|||
// Send messages
|
||||
{
|
||||
LOCK(pnode->cs_sendProcessing);
|
||||
m_msgproc->SendMessages(pnode, flagInterruptMsgProc);
|
||||
m_msgproc->SendMessages(pnode);
|
||||
}
|
||||
|
||||
if (flagInterruptMsgProc)
|
||||
|
|
|
@ -466,7 +466,7 @@ class NetEventsInterface
|
|||
{
|
||||
public:
|
||||
virtual bool ProcessMessages(CNode* pnode, std::atomic<bool>& interrupt) = 0;
|
||||
virtual bool SendMessages(CNode* pnode, std::atomic<bool>& interrupt) = 0;
|
||||
virtual bool SendMessages(CNode* pnode) = 0;
|
||||
virtual void InitializeNode(CNode* pnode) = 0;
|
||||
virtual void FinalizeNode(NodeId id, bool& update_connection_time) = 0;
|
||||
|
||||
|
|
|
@ -3218,7 +3218,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
bool PeerLogicValidation::SendMessages(CNode* pto, std::atomic<bool>& interruptMsgProc)
|
||||
bool PeerLogicValidation::SendMessages(CNode* pto)
|
||||
{
|
||||
const Consensus::Params& consensusParams = Params().GetConsensus();
|
||||
{
|
||||
|
|
|
@ -68,16 +68,20 @@ public:
|
|||
void InitializeNode(CNode* pnode) override;
|
||||
/** Handle removal of a peer by updating various state and removing it from mapNodeState */
|
||||
void FinalizeNode(NodeId nodeid, bool& fUpdateConnectionTime) override;
|
||||
/** Process protocol messages received from a given node */
|
||||
/**
|
||||
* Process protocol messages received from a given node
|
||||
*
|
||||
* @param[in] pfrom The node which we have received messages from.
|
||||
* @param[in] interrupt Interrupt condition for processing threads
|
||||
*/
|
||||
bool ProcessMessages(CNode* pfrom, std::atomic<bool>& interrupt) override;
|
||||
/**
|
||||
* Send queued protocol messages to be sent to a give node.
|
||||
*
|
||||
* @param[in] pto The node which we are sending messages to.
|
||||
* @param[in] interrupt Interrupt condition for processing threads
|
||||
* @return True if there is more work to be done
|
||||
*/
|
||||
bool SendMessages(CNode* pto, std::atomic<bool>& interrupt) override EXCLUSIVE_LOCKS_REQUIRED(pto->cs_sendProcessing);
|
||||
bool SendMessages(CNode* pto) override EXCLUSIVE_LOCKS_REQUIRED(pto->cs_sendProcessing);
|
||||
|
||||
/** Consider evicting an outbound peer based on the amount of time they've been behind our tip */
|
||||
void ConsiderEviction(CNode *pto, int64_t time_in_seconds);
|
||||
|
|
|
@ -54,7 +54,6 @@ BOOST_FIXTURE_TEST_SUITE(denialofservice_tests, TestingSetup)
|
|||
// work.
|
||||
BOOST_AUTO_TEST_CASE(outbound_slow_chain_eviction)
|
||||
{
|
||||
std::atomic<bool> interruptDummy(false);
|
||||
|
||||
// Mock an outbound peer
|
||||
CAddress addr1(ip(0xa0b0c001), NODE_NONE);
|
||||
|
@ -75,7 +74,7 @@ BOOST_AUTO_TEST_CASE(outbound_slow_chain_eviction)
|
|||
// Test starts here
|
||||
{
|
||||
LOCK2(cs_main, dummyNode1.cs_sendProcessing);
|
||||
peerLogic->SendMessages(&dummyNode1, interruptDummy); // should result in getheaders
|
||||
peerLogic->SendMessages(&dummyNode1); // should result in getheaders
|
||||
}
|
||||
{
|
||||
LOCK2(cs_main, dummyNode1.cs_vSend);
|
||||
|
@ -88,7 +87,7 @@ BOOST_AUTO_TEST_CASE(outbound_slow_chain_eviction)
|
|||
SetMockTime(nStartTime+21*60);
|
||||
{
|
||||
LOCK2(cs_main, dummyNode1.cs_sendProcessing);
|
||||
peerLogic->SendMessages(&dummyNode1, interruptDummy); // should result in getheaders
|
||||
peerLogic->SendMessages(&dummyNode1); // should result in getheaders
|
||||
}
|
||||
{
|
||||
LOCK2(cs_main, dummyNode1.cs_vSend);
|
||||
|
@ -98,7 +97,7 @@ BOOST_AUTO_TEST_CASE(outbound_slow_chain_eviction)
|
|||
SetMockTime(nStartTime+24*60);
|
||||
{
|
||||
LOCK2(cs_main, dummyNode1.cs_sendProcessing);
|
||||
peerLogic->SendMessages(&dummyNode1, interruptDummy); // should result in disconnect
|
||||
peerLogic->SendMessages(&dummyNode1); // should result in disconnect
|
||||
}
|
||||
BOOST_CHECK(dummyNode1.fDisconnect == true);
|
||||
SetMockTime(0);
|
||||
|
@ -192,7 +191,6 @@ BOOST_AUTO_TEST_CASE(stale_tip_peer_management)
|
|||
|
||||
BOOST_AUTO_TEST_CASE(DoS_banning)
|
||||
{
|
||||
std::atomic<bool> interruptDummy(false);
|
||||
|
||||
connman->ClearBanned();
|
||||
CAddress addr1(ip(0xa0b0c001), NODE_NONE);
|
||||
|
@ -207,7 +205,7 @@ BOOST_AUTO_TEST_CASE(DoS_banning)
|
|||
}
|
||||
{
|
||||
LOCK2(cs_main, dummyNode1.cs_sendProcessing);
|
||||
peerLogic->SendMessages(&dummyNode1, interruptDummy);
|
||||
peerLogic->SendMessages(&dummyNode1);
|
||||
}
|
||||
BOOST_CHECK(connman->IsBanned(addr1));
|
||||
BOOST_CHECK(!connman->IsBanned(ip(0xa0b0c001|0x0000ff00))); // Different IP, not banned
|
||||
|
@ -224,7 +222,7 @@ BOOST_AUTO_TEST_CASE(DoS_banning)
|
|||
}
|
||||
{
|
||||
LOCK2(cs_main, dummyNode2.cs_sendProcessing);
|
||||
peerLogic->SendMessages(&dummyNode2, interruptDummy);
|
||||
peerLogic->SendMessages(&dummyNode2);
|
||||
}
|
||||
BOOST_CHECK(!connman->IsBanned(addr2)); // 2 not banned yet...
|
||||
BOOST_CHECK(connman->IsBanned(addr1)); // ... but 1 still should be
|
||||
|
@ -234,7 +232,7 @@ BOOST_AUTO_TEST_CASE(DoS_banning)
|
|||
}
|
||||
{
|
||||
LOCK2(cs_main, dummyNode2.cs_sendProcessing);
|
||||
peerLogic->SendMessages(&dummyNode2, interruptDummy);
|
||||
peerLogic->SendMessages(&dummyNode2);
|
||||
}
|
||||
BOOST_CHECK(connman->IsBanned(addr2));
|
||||
|
||||
|
@ -245,7 +243,6 @@ BOOST_AUTO_TEST_CASE(DoS_banning)
|
|||
|
||||
BOOST_AUTO_TEST_CASE(DoS_banscore)
|
||||
{
|
||||
std::atomic<bool> interruptDummy(false);
|
||||
|
||||
connman->ClearBanned();
|
||||
gArgs.ForceSetArg("-banscore", "111"); // because 11 is my favorite number
|
||||
|
@ -261,7 +258,7 @@ BOOST_AUTO_TEST_CASE(DoS_banscore)
|
|||
}
|
||||
{
|
||||
LOCK2(cs_main, dummyNode1.cs_sendProcessing);
|
||||
peerLogic->SendMessages(&dummyNode1, interruptDummy);
|
||||
peerLogic->SendMessages(&dummyNode1);
|
||||
}
|
||||
BOOST_CHECK(!connman->IsBanned(addr1));
|
||||
{
|
||||
|
@ -270,7 +267,7 @@ BOOST_AUTO_TEST_CASE(DoS_banscore)
|
|||
}
|
||||
{
|
||||
LOCK2(cs_main, dummyNode1.cs_sendProcessing);
|
||||
peerLogic->SendMessages(&dummyNode1, interruptDummy);
|
||||
peerLogic->SendMessages(&dummyNode1);
|
||||
}
|
||||
BOOST_CHECK(!connman->IsBanned(addr1));
|
||||
{
|
||||
|
@ -279,7 +276,7 @@ BOOST_AUTO_TEST_CASE(DoS_banscore)
|
|||
}
|
||||
{
|
||||
LOCK2(cs_main, dummyNode1.cs_sendProcessing);
|
||||
peerLogic->SendMessages(&dummyNode1, interruptDummy);
|
||||
peerLogic->SendMessages(&dummyNode1);
|
||||
}
|
||||
BOOST_CHECK(connman->IsBanned(addr1));
|
||||
gArgs.ForceSetArg("-banscore", std::to_string(DEFAULT_BANSCORE_THRESHOLD));
|
||||
|
@ -290,7 +287,6 @@ BOOST_AUTO_TEST_CASE(DoS_banscore)
|
|||
|
||||
BOOST_AUTO_TEST_CASE(DoS_bantime)
|
||||
{
|
||||
std::atomic<bool> interruptDummy(false);
|
||||
|
||||
connman->ClearBanned();
|
||||
int64_t nStartTime = GetTime();
|
||||
|
@ -309,7 +305,7 @@ BOOST_AUTO_TEST_CASE(DoS_bantime)
|
|||
}
|
||||
{
|
||||
LOCK2(cs_main, dummyNode.cs_sendProcessing);
|
||||
peerLogic->SendMessages(&dummyNode, interruptDummy);
|
||||
peerLogic->SendMessages(&dummyNode);
|
||||
}
|
||||
BOOST_CHECK(connman->IsBanned(addr));
|
||||
|
||||
|
|
Loading…
Reference in a new issue