Removing null checks for nano::bootstrap::socket since it's required to be non-null on construction and is never nulled out during execution. (#3441)

This commit is contained in:
clemahieu 2021-09-09 09:15:59 +01:00 committed by GitHub
commit 2e769bf5b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 21 deletions

View file

@ -135,13 +135,10 @@ nano::bootstrap_server::~bootstrap_server ()
void nano::bootstrap_server::stop ()
{
if (!stopped.exchange (true))
{
if (socket != nullptr)
{
socket->close ();
}
}
}
void nano::bootstrap_server::receive ()
{
@ -582,8 +579,6 @@ void nano::bootstrap_server::finish_request_async ()
}
void nano::bootstrap_server::timeout ()
{
if (socket != nullptr)
{
if (socket->has_timed_out ())
{
@ -598,12 +593,6 @@ void nano::bootstrap_server::timeout ()
socket->close ();
}
}
else
{
nano::lock_guard<nano::mutex> lock (node->bootstrap.mutex);
node->bootstrap.connections.erase (this);
}
}
namespace
{

View file

@ -59,7 +59,7 @@ public:
bool is_bootstrap_connection ();
bool is_realtime_connection ();
std::shared_ptr<std::vector<uint8_t>> receive_buffer;
std::shared_ptr<nano::socket> socket;
std::shared_ptr<nano::socket> const socket;
std::shared_ptr<nano::node> node;
nano::mutex mutex;
std::queue<std::unique_ptr<nano::message>> requests;