Skip to content

Commit

Permalink
Make p2p::closed() public.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Feb 22, 2024
1 parent 8042363 commit d952fff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
4 changes: 3 additions & 1 deletion include/bitcoin/network/p2p.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ class BCT_API p2p
/// The strand is running in this thread.
bool stranded() const NOEXCEPT;

/// The node threadpool is stopped and may still be joining.
bool closed() const NOEXCEPT;

/// TEMP HACKS.
/// -----------------------------------------------------------------------
/// Not thread safe, read from stranded handler only.
Expand Down Expand Up @@ -184,7 +187,6 @@ class BCT_API p2p
virtual void do_start(const result_handler& handler) NOEXCEPT;
virtual void do_run(const result_handler& handler) NOEXCEPT;
virtual void do_close() NOEXCEPT;
virtual bool closed() const NOEXCEPT;

/// Override to attach specialized sessions, require strand.
virtual session_seed::ptr attach_seed_session() NOEXCEPT;
Expand Down
11 changes: 5 additions & 6 deletions src/p2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,6 @@ void p2p::do_connect_handled(const config::endpoint& endpoint,
// Properties.
// ----------------------------------------------------------------------------

// protected
bool p2p::closed() const NOEXCEPT
{
return closed_.load();
}

size_t p2p::address_count() const NOEXCEPT
{
return hosts_.count();
Expand Down Expand Up @@ -421,6 +415,11 @@ bool p2p::stranded() const NOEXCEPT
return strand_.running_in_this_thread();
}

bool p2p::closed() const NOEXCEPT
{
return closed_.load();
}

// Hosts collection.
// ----------------------------------------------------------------------------
// Protected, called from session (network strand) and channel (network pool).
Expand Down
5 changes: 0 additions & 5 deletions test/p2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ class mock_p2p_session_run
{
}

bool closed() const NOEXCEPT override
{
return closed_;
}

session_inbound::ptr attach_inbound_session() NOEXCEPT override
{
return attach<mock_session_inbound>(*this);
Expand Down

0 comments on commit d952fff

Please sign in to comment.