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);
76
76
77
77
typedef int NodeId;
78
78
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
+
79
94
// Signals for message handling
80
95
struct CNodeSignals
81
96
{
82
97
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;
85
100
boost::signals2::signal<void (NodeId, const CNode*)> InitializeNode;
86
101
boost::signals2::signal<void (NodeId)> FinalizeNode;
87
102
};
Original file line number Diff line number Diff line change @@ -21,4 +21,21 @@ BOOST_AUTO_TEST_CASE(subsidy_limit_test)
21
21
BOOST_CHECK (nSum == 2099999997690000ULL );
22
22
}
23
23
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
+
24
41
BOOST_AUTO_TEST_SUITE_END ()
You can’t perform that action at this time.
0 commit comments