mirror of
https://github.com/apple/swift-nio
synced 2026-11-25 04:47:49 +00:00
ChannelHandler: provide static (un)wrap(In|Out)bound(In|Out) (#2791)
This commit is contained in:
1 parent
223b0e8eac
commit
7948ed2104
72 files changed
+369
-343
No files matched your search
@@ -59,7 +59,7 @@ public final class WebSocketFrameEncoder: ChannelOutboundHandler {
|
||||
}
|
||||
|
||||
public func write(context: ChannelHandlerContext, data: NIOAny, promise: EventLoopPromise<Void>?) {
|
||||
let data = self.unwrapOutboundIn(data)
|
||||
let data = Self.unwrapOutboundIn(data)
|
||||
|
||||
// First, we explode the frame structure and apply the mask.
|
||||
let frameHeader = FrameHeader(frame: data)
|
||||
@@ -73,13 +73,13 @@ public final class WebSocketFrameEncoder: ChannelOutboundHandler {
|
||||
if !unwrappedExtensionData.prependFrameHeaderIfPossible(frameHeader) {
|
||||
self.writeSeparateHeaderBuffer(frameHeader, context: context)
|
||||
}
|
||||
context.write(self.wrapOutboundOut(unwrappedExtensionData), promise: nil)
|
||||
context.write(Self.wrapOutboundOut(unwrappedExtensionData), promise: nil)
|
||||
} else if !applicationData.prependFrameHeaderIfPossible(frameHeader) {
|
||||
self.writeSeparateHeaderBuffer(frameHeader, context: context)
|
||||
}
|
||||
|
||||
// Ok, now we need to write the application data buffer.
|
||||
context.write(self.wrapOutboundOut(applicationData), promise: promise)
|
||||
context.write(Self.wrapOutboundOut(applicationData), promise: promise)
|
||||
}
|
||||
|
||||
/// Applies the websocket masking operation based on the passed byte buffers.
|
||||
@@ -111,7 +111,7 @@ public final class WebSocketFrameEncoder: ChannelOutboundHandler {
|
||||
|
||||
// Ok, frame header away! Before we send it we save it back onto ourselves in case we get recursively called.
|
||||
self.headerBuffer = buffer
|
||||
context.write(self.wrapOutboundOut(buffer), promise: nil)
|
||||
context.write(Self.wrapOutboundOut(buffer), promise: nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user