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

GA_disconnect does not stop session #155

Closed
pavel-kokolemin opened this issue Dec 29, 2021 · 2 comments
Closed

GA_disconnect does not stop session #155

pavel-kokolemin opened this issue Dec 29, 2021 · 2 comments

Comments

@pavel-kokolemin
Copy link

GA_disconnect does not stop non-electrum network sessions.
To reproduce call:

    GA_create_session
    GA_set_notification_handler
    GA_connect
    GA_login_user
    GA_disconnect
    GA_destroy_session

Result:
Network notifications are still received after GA_disconnect and GA_destroy_session calls (for example when you stop and restart internet connection).

The session is stopped with this change in session::disconnect:

-            if (p && p->get_network_parameters().is_electrum()) {
+            if (p) {
                 GDK_LOG_SEV(log_level::debug) << "session is something and we are in electrum. Disconnect";
                 p->disconnect();
             }

But helper boost threads are not stopped after that and so it's not a proper fix.
I'm attaching small program that could reproduce the bug.
gdk_test.zip

@LeoComandini
Copy link
Contributor

Hi @pavel-kokolemin

Sorry for the late reply.

I replicated your error with your example.
However I noticed that you are reusing the GA_auth_handler across calls.
The documentation says that "Returned GA_auth_handler should be freed using GA_destroy_auth_handler."
Creating a new GA_auth_handler for each call and calling GA_destroy_auth_handler after solves the issues on my side (GDK correctly unsubscribes and I don't receive notifications after GA_destroy_session).
Please let me know if that solves the issue for you as well.

@pavel-kokolemin
Copy link
Author

Works great after adding GA_destroy_auth_handler, thanks!

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

2 participants