-
Notifications
You must be signed in to change notification settings - Fork 41
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proper keep-alive #11
Conversation
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.
Few nits; def looks like an improvement!
req = match timeout(timeout_duration, decode(stream)).await { | ||
Ok(Ok(Some(r))) => r, | ||
Ok(Ok(None)) | Err(TimeoutError { .. }) => break, /* EOF or timeout */ | ||
Ok(Err(e)) => return Err(e), |
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.
Heh, how do we handle the top-level Err case? Are we maybe double wrapping the Result accidentally?
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.
The outer error is the timeout even though in our case it's not actually an error. The inner error is in fact an actual error in reading the underlying TCP stream. This PR doesn't change how that error gets handled. It currently is propagated to the user so they can handle such errors.
@yoshuawuyts can we merge this? wanted to hack some |
@dignifiedquire @rylev feel free to review PRs and merge! -- I think you both get the spirit of this library, so please don't let me be a limiting factor to review and move forward! |
The previous implementation was wrong due to me not understanding how things actually work 馃榾. This now keeps a connection alive until either waiting for a new HTTP request times out or the connection is closed.