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

Shutdown workqueue on close #143

Merged
merged 3 commits into from
Aug 18, 2014

Conversation

emschwar
Copy link
Contributor

Part 2 of 2 to help address #139

Depends on #140 (for lazy initialization of handler_queue)

Since the handler_queue is lazily initialized, all we have to do at connection close time is shutdown the queue and nil it out. Any subsequent reference (such as in #receive_data) will automatically re-create it, if necessary.

Eric Schwartz added 3 commits August 18, 2014 15:35
* Allow users to set the size of the GirlFriday::WorkQueue by setting
  Blather::Client.queue_size.

* The queue size is passed in as a named parameter in the last argument to
  Blather::Client.setup

* If the queue size is 0, then #receive_data will process the incoming stanza
  immediately.
Since the handler_queue is lazily initialized, all we have to do at connection
close time is shutdown the queue and nil it out. Any subsequent reference (such
as in #receive_data) will automatically re-create it, if necessary.
* If it failed to open properly, @stream might not be set, which means
  that calling #close on the Blather::Client might not be safe (it will
  raise a StreamNotReady error in the bowels of EventMachine).

* If a stream is not connected (i.e., there is no @stream or it's been
  stopped due to EM having called #unbind on it), then don't try to
  close it on Blather::Client#close
benlangfeld added a commit that referenced this pull request Aug 18, 2014
@benlangfeld benlangfeld merged commit 1f0fbbb into adhearsion:develop Aug 18, 2014
@emschwar emschwar deleted the shutdown_workqueue_on_close branch August 19, 2014 15:03
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.

2 participants