Bugfix: properly handle refused bootstrap connection (#3959)

If we currently refuse a bootstrap connection we debug assert due to
a missed return code check. This commit fixes that.
This commit is contained in:
Dimitrios Siganos 2022-09-25 14:29:01 +01:00 committed by GitHub
commit cbb120b1bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
{
@ -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 () };