[RFC] ConnectionPool rewrite and http/2 support #376
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a draft pr for a ConnectionPool reimplementation that opens the door for http/2 support. This pr has grown very large and I will need to split it up to actually land in parts. However I see benefit in showing the goal down the road. I would love some early feedback. The next step shall be to split code parts out that can go into code review on its own.
Goals
http/2
A high level overview:
HTTPConnectionPool
is a new connection pool implementation for a single connection target (as inConnectionPool.Key
) replacingHTTP1ConnectionProvider
HTTPConnectionPool.StateMachine
is the matchingStateMachine
for theHTTPConnectionPool
. It has two potential substate machines:HTTPConnectionPool.HTTP1ConnectionState
for a remote targets that support http/1.1 onlyHTTPConnectionPool.HTTP2ConnectionState
for a remote targets that support http/2 onlyHTTPConnectionPool.Connection
is a box around the actual connection forHTTP1Connection
andHTTP2Connection
that is used in the connection pool state machineHTTPConnectionPool.Manager
is a new manager of all connection pools. (thus replacingConnectionPool
)HTTPConnectionPool.Factory
is responsible for creating new HTTP connections and replaces the connection setup currently inUtils.swift
HTTP1Connection
is a wrapper around aChannel
. A notable change to before isHTTP1ClientChannelHandler
is a new channel handler that can be reused for multiple requests.HTTP1ConnectionStateMachine
is a new state machine that is used byHTTP1ClientChannelHandler
HTTP1ConnectionStateMachine
uses theHTTPRequestStateMachine
as a substate machine.State
http/2
is disabled at the moment.http/2
is very under tested