Skip to content

Commit d0f3fb9

Browse files
committed
Make chaser strand() and stranded() virtual.
1 parent 5748f8b commit d0f3fb9

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

include/bitcoin/node/chasers/chaser.hpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,15 @@ class BCN_API chaser
107107
virtual void notify_one(object_key key, const code& ec, chase event_,
108108
event_value value) const NOEXCEPT;
109109

110+
/// Strand.
111+
/// -----------------------------------------------------------------------
112+
113+
/// The chaser's strand (on the network threadpool).
114+
virtual network::asio::strand& strand() NOEXCEPT;
115+
116+
/// True if the current thread is on the chaser strand.
117+
virtual bool stranded() const NOEXCEPT;
118+
110119
/// Properties.
111120
/// -----------------------------------------------------------------------
112121

@@ -116,12 +125,6 @@ class BCN_API chaser
116125
/// Thread safe synchronous archival interface.
117126
query& archive() const NOEXCEPT;
118127

119-
/// The chaser's strand.
120-
network::asio::strand& strand() NOEXCEPT;
121-
122-
/// True if the current thread is on the chaser strand.
123-
bool stranded() const NOEXCEPT;
124-
125128
/// Top candidate is within configured span from current time.
126129
bool is_current() const NOEXCEPT;
127130

src/chasers/chaser.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,27 +102,30 @@ void chaser::notify_one(object_key key, const code& ec, chase event_,
102102
node_.notify_one(key, ec, event_, value);
103103
}
104104

105-
// Properties.
105+
// Strand.
106106
// ----------------------------------------------------------------------------
107107

108-
const node::configuration& chaser::config() const NOEXCEPT
108+
asio::strand& chaser::strand() NOEXCEPT
109109
{
110-
return node_.config();
110+
return strand_;
111111
}
112112

113-
query& chaser::archive() const NOEXCEPT
113+
bool chaser::stranded() const NOEXCEPT
114114
{
115-
return node_.archive();
115+
return strand_.running_in_this_thread();
116116
}
117117

118-
asio::strand& chaser::strand() NOEXCEPT
118+
// Properties.
119+
// ----------------------------------------------------------------------------
120+
121+
const node::configuration& chaser::config() const NOEXCEPT
119122
{
120-
return strand_;
123+
return node_.config();
121124
}
122125

123-
bool chaser::stranded() const NOEXCEPT
126+
query& chaser::archive() const NOEXCEPT
124127
{
125-
return strand_.running_in_this_thread();
128+
return node_.archive();
126129
}
127130

128131
bool chaser::is_current() const NOEXCEPT

0 commit comments

Comments
 (0)