Commit Graph
11 Commits
Author SHA1 Message Date
George BarnettandGitHub 6c5058ee2c Add a control to limit connection reuses (#678)
Motivation:

Sometimes it can be helpful to limit the number of times a connection
can be used before discarding it. AHC has no such support for this at
the moment.

Modifications:

- Add a `maximumUsesPerConnection` configuration option which defaults
  to `nil` (i.e. no limit).
- For HTTP1 we count down uses in the state machine and close the
  connection if it hits zero.
- For HTTP2, each use maps to a stream so we count down remaining uses
  in the state machine which we combine with max concurrent streams to
  limit how many streams are available per connection. We also count
  remaining uses in the HTTP2 idle handler: we treat no remaining uses
  as receiving a GOAWAY frame and notify the pool which then drains the
  streams and replaces the connection.

Result:

Users can control how many times each connection can be used.
2023-04-11 14:49:44 +01:00
Fabian FettandGitHub e5022468bb Update swiftformat to 0.48.8 (#491)
### Motivation

Our current swiftformat version does not support async/await. Since we want to add support for async/await we must update swiftformat or disable it. I tried my very best to keep the number of changes as small as possible. I assume we want to stick with the new 0.48.8 for some time.

### Changes

- Update swiftformat to 0.48.8

### Result

We can land async/await code.
2021-11-25 10:15:36 +01:00
David NadobaandGitHub b479afe4c8 Fix bug in migration from HTTP1 to HTTP2 and back to HTTP1 (#486) 2021-11-22 12:33:57 +01:00
David NadobaandGitHub 149b8d2656 [HTTP2] Integrate HTTP2StateMachine into HTTPConnectionPool.StateMachine (#462) 2021-11-02 11:51:18 +00:00
David NadobaandGitHub 4147fd647d [HTTP2] Create new connections during migration if needed (#459) 2021-10-27 18:28:51 +02:00
David NadobaandGitHub c1a60d8aa4 [HTTP2] Prepare migration actions (#456) 2021-10-13 17:11:04 +02:00
David NadobaandGitHub a57c4b309c [HTTP2ConnectionPool] added HTTP2StateMachine (#447) 2021-10-05 11:19:41 +02:00
Fabian FettandGitHub 0c36de21d6 HTTPConnectionPool timeout requests: preserve connection errors
If a request times out because no connection could be attained, we should fail the request with the last connection creation error. If no connection creation error is present and there is no active connection, we fail the request with a connectTimeout error.
2021-09-13 18:22:29 +02:00
Fabian FettandGitHub 4d726bad8d Add ConnectionPool HTTP1StateMachine (#416) 2021-09-09 15:34:03 +02:00
05e570dd87 Add MockTools for testing HTTP1ConnectionPool.StateMachine (#417)
Co-authored-by: Cory Benfield <lukasa@apple.com>
2021-09-08 17:45:09 +02:00
7d3c578472 HTTP1Connections state machine for ConnectionPool (#413)
Co-authored-by: George Barnett <gbarnett@apple.com>
2021-09-06 12:56:20 +02:00