mirror of
https://github.com/apple/swift-nio
synced 2026-11-29 05:24:21 +00:00
rename ctx to context (#842)
Motivation: `ctx` was always an abbreviation was 'context` and in Swift we don't really use abbreviations, so let's fix it. Modifications: - rename all instances of `ctx` to `context` Result: - fixes #483
This commit is contained in:
1 parent
862533d089
commit
a41280919e
55 files changed
+1287
-1285
No files matched your search
@@ -31,9 +31,9 @@ public final class HTTPServerProtocolErrorHandler: ChannelDuplexHandler, Removab
|
||||
|
||||
public init() {}
|
||||
|
||||
public func errorCaught(ctx: ChannelHandlerContext, error: Error) {
|
||||
public func errorCaught(context: ChannelHandlerContext, error: Error) {
|
||||
guard error is HTTPParserError else {
|
||||
ctx.fireErrorCaught(error)
|
||||
context.fireErrorCaught(error)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -47,15 +47,15 @@ public final class HTTPServerProtocolErrorHandler: ChannelDuplexHandler, Removab
|
||||
if !self.hasUnterminatedResponse {
|
||||
let headers = HTTPHeaders([("Connection", "close"), ("Content-Length", "0")])
|
||||
let head = HTTPResponseHead(version: .init(major: 1, minor: 1), status: .badRequest, headers: headers)
|
||||
ctx.write(self.wrapOutboundOut(.head(head)), promise: nil)
|
||||
ctx.writeAndFlush(self.wrapOutboundOut(.end(nil)), promise: nil)
|
||||
context.write(self.wrapOutboundOut(.head(head)), promise: nil)
|
||||
context.writeAndFlush(self.wrapOutboundOut(.end(nil)), promise: nil)
|
||||
}
|
||||
|
||||
// Now pass the error on in case someone else wants to see it.
|
||||
ctx.fireErrorCaught(error)
|
||||
context.fireErrorCaught(error)
|
||||
}
|
||||
|
||||
public func write(ctx: ChannelHandlerContext, data: NIOAny, promise: EventLoopPromise<Void>?) {
|
||||
public func write(context: ChannelHandlerContext, data: NIOAny, promise: EventLoopPromise<Void>?) {
|
||||
let res = self.unwrapOutboundIn(data)
|
||||
switch res {
|
||||
case .head:
|
||||
@@ -67,6 +67,6 @@ public final class HTTPServerProtocolErrorHandler: ChannelDuplexHandler, Removab
|
||||
precondition(self.hasUnterminatedResponse)
|
||||
self.hasUnterminatedResponse = false
|
||||
}
|
||||
ctx.write(data, promise: promise)
|
||||
context.write(data, promise: promise)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user