Reconnect on every Reason Code > 0x80 received in the CONNACK packet

Summary: related to T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28217
This commit is contained in:
Korina Šimičević
2024-02-29 13:05:11 +01:00
parent 3abacf7a41
commit a1249b433d
3 changed files with 40 additions and 59 deletions

View File

@@ -327,9 +327,8 @@ public:
if (!rc.has_value()) // reason code not allowed in CONNACK
return complete(client::error::malformed_packet);
auto ec = to_asio_error(*rc);
if (ec)
return complete(ec);
if (*rc)
return complete(asio::error::try_again);
if (_ctx.co_props[prop::authentication_method].has_value())
return _ctx.authenticator.async_auth(
@@ -425,20 +424,6 @@ private:
_cancellation_state.slot().clear();
std::move(_handler)(ec);
}
static error_code to_asio_error(reason_code rc) {
using namespace boost::asio::error;
using namespace reason_codes;
if (rc == success)
return {};
if (rc == unspecified_error || rc == server_unavailable ||
rc == server_busy || rc == connection_rate_exceeded)
return connection_refused;
return access_denied;
}
};