File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed
Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -76,12 +76,27 @@ void SocketSendData(CNode *pnode);
7676
7777typedef int NodeId;
7878
79+ struct CombinerAll
80+ {
81+ typedef bool result_type;
82+
83+ template <typename I>
84+ bool operator ()(I first, I last) const
85+ {
86+ while (first != last) {
87+ if (!(*first)) return false ;
88+ ++first;
89+ }
90+ return true ;
91+ }
92+ };
93+
7994// Signals for message handling
8095struct CNodeSignals
8196{
8297 boost::signals2::signal<int ()> GetHeight;
83- boost::signals2::signal<bool (CNode*)> ProcessMessages;
84- boost::signals2::signal<bool (CNode*, bool )> SendMessages;
98+ boost::signals2::signal<bool (CNode*), CombinerAll > ProcessMessages;
99+ boost::signals2::signal<bool (CNode*, bool ), CombinerAll > SendMessages;
85100 boost::signals2::signal<void (NodeId, const CNode*)> InitializeNode;
86101 boost::signals2::signal<void (NodeId)> FinalizeNode;
87102};
Original file line number Diff line number Diff line change @@ -21,4 +21,21 @@ BOOST_AUTO_TEST_CASE(subsidy_limit_test)
2121 BOOST_CHECK (nSum == 2099999997690000ULL );
2222}
2323
24+ bool ReturnFalse () { return false ; }
25+ bool ReturnTrue () { return true ; }
26+
27+ BOOST_AUTO_TEST_CASE (test_combiner_all)
28+ {
29+ boost::signals2::signal<bool (), CombinerAll> Test;
30+ BOOST_CHECK (Test ());
31+ Test.connect (&ReturnFalse);
32+ BOOST_CHECK (!Test ());
33+ Test.connect (&ReturnTrue);
34+ BOOST_CHECK (!Test ());
35+ Test.disconnect (&ReturnFalse);
36+ BOOST_CHECK (Test ());
37+ Test.disconnect (&ReturnTrue);
38+ BOOST_CHECK (Test ());
39+ }
40+
2441BOOST_AUTO_TEST_SUITE_END ()
You can’t perform that action at this time.
0 commit comments