Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG/MINOR: mux-h2: fix http-request and http-keep-alive timeouts again
Stefan Behte reported that since commit f279a2f ("BUG/MINOR: mux-h2: refresh the idle_timer when the mux is empty"), the http-request and http-keep-alive timeouts don't work anymore on H2. Before this patch, and since 3e448b9 ("BUG/MEDIUM: mux-h2: make sure control frames do not refresh the idle timeout"), they would only be refreshed after stream frames were sent (HEADERS or DATA) but the patch above that adds more refresh points broke these so they don't expire anymore as long as there's some activity. We cannot just revert the fix since it also addressed an isse by which sometimes the timeout would trigger too early and provoque truncated responses. The right approach here is in fact to only use refresh the idle timer when the mux buffer was flushed from any such stream frames. In order to achieve this, we're now setting a flag on the connection whenever we write a stream frame, and we consider that flag when deciding to refresh the buffer after it's emptied. This way we'll only clear that flag once the buffer is empty and there were stream data in it, not if there were no such stream data. In theory it remains possible to leave the flag on if some control data is appended after the buffer and it's never cleared, but in practice it's not a problem as a buffer will always get sent in large blocks when the window opens. Even a large buffer should be emptied once in a while as control frames will not fill it as much as data frames could. Given the patch above was backported as far as 2.6, this patch should also be backported as far as 2.6.
- Loading branch information