Skip to content

Commit

Permalink
Merge pull request #396 from evoskuil/master
Browse files Browse the repository at this point in the history
Add p2p::suspended().
  • Loading branch information
evoskuil authored May 8, 2024
2 parents 965d11c + 3cba711 commit 0ec5736
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/bitcoin/network/p2p.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ class BCT_API p2p
/// Suspensions.
/// -----------------------------------------------------------------------

/// Nework connections are suspended (incoming and/or outgoing).
virtual bool suspended() const NOEXCEPT;

/// Suspend/resume all connections.
virtual void suspend(const code& ec) NOEXCEPT;
virtual void resume() NOEXCEPT;
Expand Down
5 changes: 5 additions & 0 deletions src/p2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,11 @@ void p2p::do_connect_handled(const config::endpoint& endpoint,
// Suspensions.
// ----------------------------------------------------------------------------

bool p2p::suspended() const NOEXCEPT
{
return connect_suspended_.load() || accept_suspended_.load();
}

void p2p::suspend_acceptors() NOEXCEPT
{
accept_suspended_.store(true);
Expand Down

0 comments on commit 0ec5736

Please sign in to comment.