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 @@ -78,12 +78,27 @@ void SocketSendData(CNode *pnode);
78
78
79
79
typedef int NodeId;
80
80
81
+ struct CombinerAll
82
+ {
83
+ typedef bool result_type;
84
+
85
+ template <typename I>
86
+ bool operator ()(I first, I last) const
87
+ {
88
+ while (first != last) {
89
+ if (!(*first)) return false ;
90
+ ++first;
91
+ }
92
+ return true ;
93
+ }
94
+ };
95
+
81
96
// Signals for message handling
82
97
struct CNodeSignals
83
98
{
84
99
boost::signals2::signal<int ()> GetHeight;
85
- boost::signals2::signal<bool (CNode*)> ProcessMessages;
86
- boost::signals2::signal<bool (CNode*, bool )> SendMessages;
100
+ boost::signals2::signal<bool (CNode*), CombinerAll > ProcessMessages;
101
+ boost::signals2::signal<bool (CNode*, bool ), CombinerAll > SendMessages;
87
102
boost::signals2::signal<void (NodeId, const CNode*)> InitializeNode;
88
103
boost::signals2::signal<void (NodeId)> FinalizeNode;
89
104
};
Original file line number Diff line number Diff line change @@ -23,4 +23,21 @@ BOOST_AUTO_TEST_CASE(subsidy_limit_test)
23
23
BOOST_CHECK (nSum == 2099999997690000ULL );
24
24
}
25
25
26
+ bool ReturnFalse () { return false ; }
27
+ bool ReturnTrue () { return true ; }
28
+
29
+ BOOST_AUTO_TEST_CASE (test_combiner_all)
30
+ {
31
+ boost::signals2::signal<bool (), CombinerAll> Test;
32
+ BOOST_CHECK (Test ());
33
+ Test.connect (&ReturnFalse);
34
+ BOOST_CHECK (!Test ());
35
+ Test.connect (&ReturnTrue);
36
+ BOOST_CHECK (!Test ());
37
+ Test.disconnect (&ReturnFalse);
38
+ BOOST_CHECK (Test ());
39
+ Test.disconnect (&ReturnTrue);
40
+ BOOST_CHECK (Test ());
41
+ }
42
+
26
43
BOOST_AUTO_TEST_SUITE_END ()
You can’t perform that action at this time.
0 commit comments