-
Notifications
You must be signed in to change notification settings - Fork 30
feat: Implement Hyper specific HttpTransport #105
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
base: feat/hyper-as-feature
Are you sure you want to change the base?
Conversation
| pub fn new() -> Self { | ||
| let connector = hyper_util::client::legacy::connect::HttpConnector::new(); | ||
| let timeout_connector = TimeoutConnector::new(connector); | ||
| let client = HyperClient::builder(TokioExecutor::new()).build(timeout_connector); |
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.
We are instantiating a new tokio executor here and in a couple of other places I'll point out. Think we need to add the option to provide the executor, or should we wait until it is specifically requested?
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.
I am not sure if would want to extend the API surface with more external library dependencies unless we have a driver for it. I think, because we have this whole transport behind a trait, worse case scenario you can copy/paste this transport and use your own executor. Where this would have been more important when the transport wasn't replaceable.
| .build(); | ||
|
|
||
| let timeout_connector = TimeoutConnector::new(connector); | ||
| let client = HyperClient::builder(TokioExecutor::new()).build(timeout_connector); |
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.
TokExecutor::new
| timeout_connector.set_read_timeout(self.read_timeout); | ||
| timeout_connector.set_write_timeout(self.write_timeout); | ||
|
|
||
| let client = HyperClient::builder(TokioExecutor::new()).build(timeout_connector); |
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.
TokExecutor::new
| /// | ||
| /// let transport = MyTransport::new(); | ||
| /// let client = ClientBuilder::for_url("https://example.com/events")? | ||
| /// let client = ClientBuilder::for_url("https://sse.dev/test") |
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.
Do we know who maintains sse.dev?
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.
No, I don't. The site shows a "Brought to you by https://www.stubber.com/", but that's about as much as I know.
If you want, we could change it over to the live scores feed we control: http://live-test-scores.herokuapp.com/scores
| /// | ||
| /// This timeout applies when reading data from the connection. | ||
| /// There is no read timeout by default. | ||
| pub fn read_timeout(mut self, timeout: Duration) -> Self { |
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.
This is still just an initial socket read timeout, correct? We don't yet have a keepalive style timeout?
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.
It does sound like maybe hyper supports tcp keepalive though.
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.
No, this should be a real read timeout since we are using the timeout connector. If you don't send something every X seconds, this will drop the connection if configured low enough.
d5775c7 to
3aed52f
Compare
No description provided.