Skip to content

Commit ad97a25

Browse files
committed
Code review
1 parent 068235c commit ad97a25

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

Diff for: Sources/AsyncHTTPClient/ConnectionPool/HTTP1.1/HTTP1ClientChannelHandler.swift

+7-11
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ final class HTTP1ClientChannelHandler: ChannelDuplexHandler {
9191
self.run(action, context: context)
9292
}
9393

94-
func close(context: ChannelHandlerContext, mode: CloseMode, promise: EventLoopPromise<Void>?) {
95-
context.close(mode: mode, promise: promise)
96-
}
97-
9894
func write(context: ChannelHandlerContext, data: NIOAny, promise: EventLoopPromise<Void>?) {
9995
self.logger.trace("New request to execute")
10096

@@ -135,28 +131,28 @@ final class HTTP1ClientChannelHandler: ChannelDuplexHandler {
135131

136132
// MARK: - Run Actions
137133

138-
func run(_ action: HTTP1ConnectionStateMachine.Action, context: ChannelHandlerContext) {
134+
private func run(_ action: HTTP1ConnectionStateMachine.Action, context: ChannelHandlerContext) {
139135
switch action {
140136
case .sendRequestHead(let head, startBody: let startBody):
141137
if startBody {
142-
context.write(wrapOutboundOut(.head(head)), promise: nil)
138+
context.write(self.wrapOutboundOut(.head(head)), promise: nil)
143139
context.flush()
144140

145141
self.request!.requestHeadSent()
146142
self.request!.resumeRequestBodyStream()
147143
} else {
148-
context.write(wrapOutboundOut(.head(head)), promise: nil)
149-
context.write(wrapOutboundOut(.end(nil)), promise: nil)
144+
context.write(self.wrapOutboundOut(.head(head)), promise: nil)
145+
context.write(self.wrapOutboundOut(.end(nil)), promise: nil)
150146
context.flush()
151147

152148
self.request!.requestHeadSent()
153149
}
154150

155151
case .sendBodyPart(let part):
156-
context.writeAndFlush(wrapOutboundOut(.body(part)), promise: nil)
152+
context.writeAndFlush(self.wrapOutboundOut(.body(part)), promise: nil)
157153

158154
case .sendRequestEnd:
159-
context.writeAndFlush(wrapOutboundOut(.end(nil)), promise: nil)
155+
context.writeAndFlush(self.wrapOutboundOut(.end(nil)), promise: nil)
160156

161157
case .pauseRequestBodyStream:
162158
self.request!.pauseRequestBodyStream()
@@ -293,7 +289,7 @@ final class HTTP1ClientChannelHandler: ChannelDuplexHandler {
293289
self.run(action, context: self.channelContext)
294290
}
295291

296-
func cancelRequest0(_ request: HTTPExecutingRequest) {
292+
private func cancelRequest0(_ request: HTTPExecutingRequest) {
297293
guard self.request === request else {
298294
// very likely we got threading issues here...
299295
return

Diff for: Sources/AsyncHTTPClient/ConnectionPool/HTTP1.1/HTTP1Connection.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ protocol HTTP1ConnectionDelegate {
2525
final class HTTP1Connection {
2626
let channel: Channel
2727

28-
/// the connection pool that created the connection
28+
/// the connection's delegate, that will be informed about connection close and connection release
29+
/// (ready to run next request).
2930
let delegate: HTTP1ConnectionDelegate
3031

3132
enum State {

0 commit comments

Comments
 (0)