-
Notifications
You must be signed in to change notification settings - Fork 84
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
Make HTTP2StreamChannel generic over a message type #218
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Broadly looks good, I have a few notes.
@@ -615,7 +621,7 @@ internal extension HTTP2StreamChannel { | |||
/// | |||
/// - parameters: | |||
/// - frame: The `HTTP2Frame` received from the network. | |||
func receiveInboundFrame(_ frame: HTTP2Frame) { | |||
func receiveInbound(_ message: Message) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd rather that this didn't change, and instead that we added a line to convert the frame to Message
in this method.
@@ -77,62 +84,80 @@ extension MultiplexerAbstractChannel { | |||
switch self.baseChannel { | |||
case .frameBased(let base): | |||
base.configure(initializer: initializer, userPromise: promise) | |||
case .payloadBased(let base): | |||
base.configure(initializer: initializer, userPromise: promise) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should fatalError
here: we don't ever want this branch to be hit.
Motivation: As part of apple#214 we need to make `HTTP2StreamChannel` generic over the type of message it expects to read and write. This allows us to define an `HTTP2StreamChannel` which uses `HTTP2Frame.FramePayload` as its currency type, rather than `HTTP2Frame`. Modifications: - Make `HTTP2StreamChannel` generic over `Message` which is constrained by conformance to `HTTP2FrameConvertible` and `HTTP2FramePayloadConvertible` - `HTTP2StreamChannel` now expects to read in `Message`s (as opposed to `HTTP2Frame`s) and have `Message`s written in to it. - Added typealiases for frame and payload based stream channels. - Added support for the payload based channel in `MultiplexerAbstractChannel` (although one can't be created yet). Result: We can create payload based stream channels.
bf8910a
to
4b3badc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great.
Motivation:
As part of #214 we need to make
HTTP2StreamChannel
generic over the typeof message it expects to read and write. This allows us to define an
HTTP2StreamChannel
which usesHTTP2Frame.FramePayload
as itscurrency type, rather than
HTTP2Frame
.Modifications:
HTTP2StreamChannel
generic overMessage
which is constrainedby conformance to
HTTP2FrameConvertible
andHTTP2FramePayloadConvertible
HTTP2StreamChannel
now expects to read inMessage
s (as opposed toHTTP2Frame
s) and haveMessage
s written in to it.MultiplexerAbstractChannel
(although one can't be created yet).Result:
We can create payload based stream channels.