12 Commits

Author SHA1 Message Date
Fabian Fett 3c45dbde2d Fix Connection Creation Crash (#873)
### Motivation

When creating a connection, we wrongfully assumed that
`failedToCreateNewConnection` will always be called before
`http*ConnectionClosed` in the `HTTPConnectionPoolStateMachine`. However
this is far from correct. In NIO Futures are fulfilled before
`ChannelHandler` callbacks. Ordering in futures should not be assumed in
such a complex project.

### Change

We change the `http*ConnectionClosed` methods to be noops, if the
connection is in the starting state. We instead wait for the
`failedToCreateNewConnection` to create backoff timers and friends.

rdar://164674912

---------

Co-authored-by: George Barnett <gbarnett@apple.com>
2025-12-01 09:31:32 +01:00
Rick Newton-Rogers c621142327 Adopt GitHub actions (#780)
Migrate CI to use GitHub Actions.

### Motivation:

To migrate to GitHub actions and centralised infrastructure.

### Modifications:

Changes of note:
* Adopt swift-format using rules from SwiftNIO.
* Remove scripts and docker files which are no longer needed.
* Disabled warnings-as-errors on Swift 6.0 CI pipelines for now.

### Result:

Feature parity with old CI.
2024-10-29 15:01:46 +00:00
George Barnett 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 Fett 2fe3f42fee Crash fix: HTTP2Connections emit events after the pool has closed them. (#481) 2021-11-19 12:33:08 +01:00
David Nadoba 18a58bb874 [HTTP2] Improve performance of backoff timer done event (#464) 2021-11-03 14:29:24 +00:00
David Nadoba 149b8d2656 [HTTP2] Integrate HTTP2StateMachine into HTTPConnectionPool.StateMachine (#462) 2021-11-02 11:51:18 +00:00
David Nadoba 4147fd647d [HTTP2] Create new connections during migration if needed (#459) 2021-10-27 18:28:51 +02:00
David Nadoba c1a60d8aa4 [HTTP2] Prepare migration actions (#456) 2021-10-13 17:11:04 +02:00
David Nadoba a0b09857d8 [HTTP2StateMachine] test and fix HTTP2 go away (#452) 2021-10-05 13:59:09 +02:00
David Nadoba a57c4b309c [HTTP2ConnectionPool] added HTTP2StateMachine (#447) 2021-10-05 11:19:41 +02:00
David Nadoba 96963810cb [HTTP2Connections] Return if connection was idle before lease (#451) 2021-10-02 14:06:13 +02:00
David Nadoba 88d47f12ca [HTTP2ConnectionPool] added HTTP2Connections struct (#440)
One step closer to support HTTP/2 in the new connection pool. 
`HTTP2Connections` will be used in a new `HTTP2StateMaschine` in a follow up PR.
2021-09-28 12:06:54 +02:00