-
Notifications
You must be signed in to change notification settings - Fork 99
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
Better encapsulation for connection instances #353
Conversation
Reading through this, one possible tweak that stands out... perhaps EDIT: Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gave it a quick look-over, really like the "hide the 'state' implementation details" idea. 👍
Alrighty. I'm going to push ahead with this, and roll a new release. We need to get this all into the wild particularly since we've switched to There's a bunch of follow up I want to do from this one onwards, really tightening up any possible race condition areas, getting coverage all the way up, sorting out tls-over-tls support etc... and generally getting |
This pull request introduces a refactoring to more tightly encapsulate Connection instances, so that the connection pool isn't reaching inside implementation details, but instead has a neat interface to work against. This'll be a precursor to further work on tightening up the implementation, ensuring we're more obviously guarded against potential race conditions, etc...
In addition to the existing
handle_request
andclose
methods, the interface the connection pool uses here are...should_close
- The connection has expired its keep alive, or been closed by the remote end.is_idle
- The connection is currently idle. It may optionally be removed from the pool, if needed.is_closed
- The connection is closed. It should be removed from the pool.is_available
- The connection is in a state where it can current accept another request.An obvious stand-alone follow up to this would be to make other methods and attributes on the connection private.