|
15 | 15 | import NIOCore
|
16 | 16 |
|
17 | 17 | extension HTTPConnectionPool {
|
| 18 | + /// Represents the state of a single HTTP/1.1 connection |
18 | 19 | private struct HTTP1ConnectionState {
|
19 | 20 | enum State {
|
20 | 21 | /// the connection is creating a connection. Valid transitions are to: .backingOff, .available and .failed
|
@@ -161,10 +162,23 @@ extension HTTPConnectionPool {
|
161 | 162 | }
|
162 | 163 |
|
163 | 164 | /// A structure to hold the currently active HTTP/1.1 connections.
|
| 165 | + /// |
| 166 | + /// The general purpose connection pool (pool for requests that don't have special `EventLoop` |
| 167 | + /// requirements) will grow up until `maximumConcurrentConnections`. If requests have |
| 168 | + /// special `EventLoop` requirements overflow connections might be opened. |
| 169 | + /// |
| 170 | + /// All connections live in the same `connections` array. In the front are the general purpose |
| 171 | + /// connections. In the back (starting with the `overflowIndex`) are the connections for |
| 172 | + /// requests with special needs. |
164 | 173 | struct HTTP1Connections {
|
| 174 | + /// The maximum number of connections in the general purpose pool. |
165 | 175 | private let maximumConcurrentConnections: Int
|
| 176 | + /// A connectionID generator. |
166 | 177 | private let generator: Connection.ID.Generator
|
| 178 | + /// The connections states |
167 | 179 | private var connections: [HTTP1ConnectionState]
|
| 180 | + /// The index after which you will find the connections for requests with `EventLoop` |
| 181 | + /// requirements in `connections`. |
168 | 182 | private var overflowIndex: Array<HTTP1ConnectionState>.Index
|
169 | 183 |
|
170 | 184 | init(maximumConcurrentConnections: Int, generator: Connection.ID.Generator) {
|
|
0 commit comments