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

Clean up some bugs in the callback handling #5

Merged
merged 3 commits into from
Sep 4, 2019

Conversation

resuna
Copy link
Member

@resuna resuna commented Sep 4, 2019

In some rare cases if you open and close a connection fast enough, synchronously, the close can happen before the callback gets through the zookeeper event queue and the Tcl event queue. This fix handles both ends of the problem:

  1. Don't set up the callback if you're performing the init synchronously. The previous code put an event on the queue and exited the event handler early if there was no callback routine. This passes null as the event handler for zookeeper_init if there's no callback.

  2. Don't zap the magic number in the zookeeper object until after calling zookeeper_close, because its cleanup may fire any pending handlers.

@resuna resuna requested a review from pm-conej September 4, 2019 15:49
@resuna resuna removed the request for review from pm-conej September 4, 2019 17:19
@resuna resuna merged commit c522dce into master Sep 4, 2019
@resuna resuna deleted the zookeeper_init_callback branch September 4, 2019 17:20
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

Successfully merging this pull request may close these issues.

None yet

2 participants