Skip to content

Commit

Permalink
[C] Handle connecting to Archive without credentials. (#1716)
Browse files Browse the repository at this point in the history
  • Loading branch information
amoskvin authored Jan 15, 2025
1 parent 33c78b2 commit 21ed1e9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions aeron-archive/src/main/c/client/aeron_archive_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ int aeron_archive_context_init(aeron_archive_context_t **ctx)
_ctx->idle_strategy_state = NULL;
_ctx->owns_idle_strategy = false;

aeron_archive_context_set_credentials_supplier(_ctx, NULL, NULL, NULL, NULL);

_ctx->error_handler = NULL;
_ctx->error_handler_clientd = NULL;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,21 @@

aeron_archive_encoded_credentials_t *aeron_archive_credentials_supplier_encoded_credentials(aeron_archive_credentials_supplier_t *supplier)
{
if (NULL == supplier->encoded_credentials) {
return NULL;
}

return supplier->encoded_credentials(supplier->clientd);
}

aeron_archive_encoded_credentials_t *aeron_archive_credentials_supplier_on_challenge(
aeron_archive_credentials_supplier_t *supplier,
aeron_archive_encoded_credentials_t *encoded_challenge)
{
if (NULL == supplier->on_challenge) {
return NULL;
}

return supplier->on_challenge(encoded_challenge, supplier->clientd);
}

Expand Down
8 changes: 4 additions & 4 deletions aeron-archive/src/main/c/client/aeron_archive_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ bool aeron_archive_proxy_try_connect(
strlen(control_response_channel));
aeron_archive_client_authConnectRequest_put_encodedCredentials(
&codec,
encoded_credentials->data,
encoded_credentials->length);
NULL == encoded_credentials ? "" : encoded_credentials->data,
NULL == encoded_credentials ? 0 : encoded_credentials->length);

return aeron_archive_proxy_offer_once(
archive_proxy,
Expand Down Expand Up @@ -197,8 +197,8 @@ bool aeron_archive_proxy_challenge_response(
aeron_archive_client_challengeResponse_set_correlationId(&codec, correlation_id);
aeron_archive_client_challengeResponse_put_encodedCredentials(
&codec,
encoded_credentials->data,
encoded_credentials->length);
NULL == encoded_credentials ? "" : encoded_credentials->data,
NULL == encoded_credentials ? 0 : encoded_credentials->length);

return aeron_archive_proxy_offer_once(
archive_proxy,
Expand Down

0 comments on commit 21ed1e9

Please sign in to comment.