Skip to content

Commit

Permalink
Bugfix: properly handle refused bootstrap connection (nanocurrency#3959)
Browse files Browse the repository at this point in the history
If we currently refuse a bootstrap connection we debug assert due to
a missed return code check. This commit fixes that.
  • Loading branch information
dsiganos authored and clemahieu committed Oct 1, 2022
1 parent d8984b0 commit 6e3b2ee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nano/node/bootstrap/bootstrap_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,11 @@ bool nano::bootstrap_server::process_message (std::unique_ptr<nano::message> mes
if (allow_bootstrap)
{
// Switch to bootstrap connection mode and handle message in subsequent bootstrap visitor
to_bootstrap_connection ();
if (!to_bootstrap_connection ())
{
stop ();
return false;
}
}
else
{
Expand All @@ -288,7 +292,7 @@ bool nano::bootstrap_server::process_message (std::unique_ptr<nano::message> mes
}
return true;
}
// It is possible for server to switch to bootstrap mode immediately after processing handshake, thus no `else if`
// the server will switch to bootstrap mode immediately after processing the first bootstrap message, thus no `else if`
if (is_bootstrap_connection ())
{
bootstrap_message_visitor bootstrap_visitor{ shared_from_this () };
Expand Down

0 comments on commit 6e3b2ee

Please # to comment.