Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

at_c: atclient_connection_hooks are unset when re-pkam authenticated #372

Open
JeremyTubongbanua opened this issue Aug 14, 2024 · 0 comments
Assignees

Comments

@JeremyTubongbanua
Copy link
Member

JeremyTubongbanua commented Aug 14, 2024

This doesn't work:

if ((exit_code = setup_hooks(&atclient1)) != 0)
{
    goto exit;
}
atlogger_log(TAG, ATLOGGER_LOGGING_LEVEL_INFO, "Hooks set up successfully.\n");
if ((exit_code = atclient_pkam_authenticate(&atclient1, atserver_host, atserver_port, &atkeys, ATSIGN)) != 0)
{
    goto exit;
}

This works:

if ((exit_code = atclient_pkam_authenticate(&atclient1, atserver_host, atserver_port, &atkeys, ATSIGN)) != 0)
{
    goto exit;
}
if ((exit_code = setup_hooks(&atclient1)) != 0)
{
    goto exit;
}
atlogger_log(TAG, ATLOGGER_LOGGING_LEVEL_INFO, "Hooks set up successfully.\n");

Hooks have to be set up after pkam authentication. If they are set up before, it seems to not be set.

Intended behaviour

I would expect hooks to be set up properly even before pkam authentication, so that they would work even during the pkam authentication process.

I suspect the bug is occurring with the static function: atclient_start_atserver_connection.

Side notes

We may even consider that when the caller calls atclient_connection_hooks_set(/* */) that we duplicate the memory of their hook functions so that we can memory manage that themselves (in the event that they free the memory of their function somehow).

We should also consider just passing the atclient *ctx along with the params.

@JeremyTubongbanua JeremyTubongbanua self-assigned this Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant