Skip to content

[HTTP2ConnectionPool] added HTTP2StateMachine #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Oct 5, 2021

Conversation

dnadoba
Copy link
Collaborator

@dnadoba dnadoba commented Sep 30, 2021

One step closer to support HTTP/2 in the new connection pool.
HTTP2StateMaschine will be integrated in HTTPConnectionPool.StateMachine in a follow up PR.

@dnadoba dnadoba force-pushed the dn-http2-state-machine branch 3 times, most recently from 660ae31 to a8679bf Compare September 30, 2021 15:47
@fabianfett fabianfett marked this pull request as ready for review October 1, 2021 06:02
@fabianfett fabianfett added the 🔨 semver/patch No public API change. label Oct 1, 2021
@fabianfett fabianfett added this to the HTTP/2 support milestone Oct 1, 2021
@dnadoba dnadoba force-pushed the dn-http2-state-machine branch from 5d14a76 to 810d927 Compare October 1, 2021 11:15
///
/// - Complexity: O(*k*), where *k* is the number of elements removed.
fileprivate mutating func popFirst(max: Int) -> [Element] {
precondition(max >= 0, "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a message, or remove the empty string :)

// If there aren't any more connections, everything is shutdown
let isShutdown: StateMachine.ConnectionAction.IsShutdown
let unclean = !(cleanupContext.cancel.isEmpty && waitingRequests.isEmpty)
if self.connections.isEmpty {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to check if we have still running http1 connections here.

@dnadoba dnadoba force-pushed the dn-http2-state-machine branch from 810d927 to 45225b9 Compare October 1, 2021 14:40
case keepConnection
}

func migrateToHTTP2(_ context: inout HTTP1Connections.HTTP2ToHTTP1MigrationContext) -> MigrateAction {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says migrate to HTTP/2, but the type here is HTTP2toHTTP1 (the other direction). Which way are we going?

import NIOHTTP2

extension HTTPConnectionPool {
struct HTTP2StateMaschine {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
struct HTTP2StateMaschine {
struct HTTP2StateMachine {

Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I think we can merge this.

@dnadoba dnadoba force-pushed the dn-http2-state-machine branch from 1751208 to a1fc238 Compare October 4, 2021 10:48
@dnadoba dnadoba force-pushed the dn-http2-state-machine branch from 981ee6f to 2e15b58 Compare October 5, 2021 07:36
@dnadoba
Copy link
Collaborator Author

dnadoba commented Oct 5, 2021

@swift-server-bot test this please

@dnadoba dnadoba merged commit a57c4b3 into swift-server:main Oct 5, 2021
@dnadoba dnadoba deleted the dn-http2-state-machine branch October 5, 2021 09:19
@swift-server swift-server deleted a comment Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants