Skip to content

Commit 363171c

Browse files
authored
Merge pull request #728 from evoskuil/master
Test
2 parents b9ffc89 + 0b8a0f9 commit 363171c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

include/bitcoin/network/protocols/protocol.hpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@
3232
namespace libbitcoin {
3333
namespace network {
3434

35+
class stoppable
36+
{
37+
public:
38+
virtual void stop(const code& ec) = 0;
39+
virtual ~stoppable() = default;
40+
};
41+
3542
/// This class is thread safe, except for:
3643
/// * start/started must be called on strand.
3744
/// * setters should only be invoked during handshake.
@@ -40,7 +47,8 @@ namespace network {
4047
/// Protocol start has no failure condition.
4148
/// A protocol can only stop its channel, not the session/network.
4249
class BCT_API protocol
43-
: public enable_shared_from_base<protocol>, public reporter
50+
: public virtual stoppable,
51+
public enable_shared_from_base<protocol>, public reporter
4452
{
4553
public:
4654
typedef std::shared_ptr<protocol> ptr;
@@ -150,8 +158,8 @@ class BCT_API protocol
150158
/// Channel is stopped or code set.
151159
virtual bool stopped(const code& ec=error::success) const NOEXCEPT;
152160

153-
/// Stop the channel.
154-
virtual void stop(const code& ec) NOEXCEPT;
161+
/// Stop the channel (stoppable::stop).
162+
void stop(const code& ec) NOEXCEPT override;
155163

156164
/// Pause reading from the socket, stops timers (requires strand).
157165
virtual void pause() NOEXCEPT;

0 commit comments

Comments
 (0)