Skip to content

Commit

Permalink
Refactoring and comments
Browse files Browse the repository at this point in the history
Large scale refactoring of code and function visibility to make the
various APIs currently under SPI more manageable.

As the API surface has become more complex with the addition of more
layers it became apparent that we needed to take steps to simplify.
  • Loading branch information
rnro committed Jul 10, 2023
1 parent f6a2279 commit ee905c4
Show file tree
Hide file tree
Showing 4 changed files with 277 additions and 315 deletions.
15 changes: 15 additions & 0 deletions Sources/NIOHTTP2/HTTP2ChannelHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,9 @@ extension NIOHTTP2Handler {
}

/// Connection-level configuration.
///
/// The settings that will be used when establishing the connection. These will be sent to the peer as part of the
/// handshake.
public struct ConnectionConfiguration: Hashable, Sendable {
public var initialSettings: HTTP2Settings = nioDefaultSettings
public var headerBlockValidation: ValidationState = .enabled
Expand All @@ -1036,13 +1039,25 @@ extension NIOHTTP2Handler {
}

/// Stream-level configuration.
///
/// The settings that will be used when establishing new streams. These mainly pertain to flow control.
public struct StreamConfiguration: Hashable, Sendable {
public var targetWindowSize: Int = 65535
public var outboundBufferSizeHighWatermark: Int = 8196
public var outboundBufferSizeLowWatermark: Int = 4092
public init() {}
}

/// Overall connection and stream-level configuration.
public struct Configuration: Hashable, Sendable {
/// The settings that will be used when establishing the connection. These will be sent to the peer as part of the
/// handshake.
public var connection: ConnectionConfiguration = .init()
/// The settings that will be used when establishing new streams. These mainly pertain to flow control.
public var stream: StreamConfiguration = .init()
public init() {}
}

/// An `EventLoopFuture` which returns a ``StreamMultiplexer`` which can be used to create new outbound HTTP/2 streams.
///
/// > Note: This is only safe to get if the ``NIOHTTP2Handler`` uses a local multiplexer,
Expand Down

0 comments on commit ee905c4

Please sign in to comment.