ChannelHandler: provide static (un)wrap(In|Out)bound(In|Out) (#2791)

This commit is contained in:
Johannes Weiss authored and GitHub committed 2024-07-18 11:55:48 +01:00
1 parent 223b0e8eac
commit 7948ed2104
72 files changed
+369 -343

No files matched your search

@@ -169,7 +169,7 @@ public final class NIOHTTPClientUpgradeHandler: ChannelDuplexHandler, RemovableC
private func addHeadersToOutboundOut(data: NIOAny) -> NIOAny {
let interceptedOutgoingRequest = self.unwrapOutboundIn(data)
let interceptedOutgoingRequest = Self.unwrapOutboundIn(data)
if case .head(var requestHead) = interceptedOutgoingRequest {
@@ -177,7 +177,7 @@ public final class NIOHTTPClientUpgradeHandler: ChannelDuplexHandler, RemovableC
self.addConnectionHeaders(to: &requestHead)
self.addUpgradeHeaders(to: &requestHead)
return self.wrapOutboundOut(.head(requestHead))
return Self.wrapOutboundOut(.head(requestHead))
}
return data
@@ -207,9 +207,9 @@ public final class NIOHTTPClientUpgradeHandler: ChannelDuplexHandler, RemovableC
self.receivedMessages.append(data)
return
}
let responsePart = unwrapInboundIn(data)
let responsePart = Self.unwrapInboundIn(data)
switch self.upgradeState {
case .awaitingConfirmationResponse:
self.firstResponseHeadReceived(context: context, responsePart: responsePart)
@@ -371,7 +371,7 @@ public final class NIOHTTPClientUpgradeHandler: ChannelDuplexHandler, RemovableC
}
assert(self.receivedMessages.isEmpty)
context.fireChannelRead(self.wrapInboundOut(data))
context.fireChannelRead(Self.wrapInboundOut(data))
// We've delivered the data. We can now remove ourselves, which should happen synchronously.
context.pipeline.removeHandler(context: context, promise: nil)