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

fix(server): add poll_ready to Service and MakeService #1767

Merged
merged 1 commit into from
Feb 27, 2019

Conversation

ubnt-intrepid
Copy link
Contributor

This PR adds the method poll_ready to Service and MakeService, which provides the ability to these services for notifying the readiness whether to accept connections or requests.

These methods corresponds to tower_service::Service::poll_ready and prevents to ignore calling this method when using tower's services in hyper::Server or hyper::server::conn::Connection.

The added methods have the default implementation and has no effect on existing code that implements Service/MakeService directly.

Copy link
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for starting this! I think this is a great idea.

@@ -26,6 +26,11 @@ pub trait Service {
/// The `Future` returned by this `Service`.
type Future: Future<Item=Response<Self::ResBody>, Error=Self::Error>;

#[doc(hidden)]
fn poll_ready(&mut self) -> Poll<(), Self::Error> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably not be doc(hidden), but include similar wording to what it says in tower-service.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added doc comment to them.

@LucioFranco
Copy link
Member

@seanmonstar do you think this would be a good time for hyper to move to the actual tower traits?

@seanmonstar
Copy link
Member

@LucioFranco I think we are close! Switching completely is breaking change, so maybe should be bundled with other breaking changes (like the http crate needs one...).

@seanmonstar seanmonstar merged commit 0bf30cc into hyperium:master Feb 27, 2019
@ubnt-intrepid ubnt-intrepid deleted the poll-ready branch February 27, 2019 17:33
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.

3 participants