@@ -38,7 +38,7 @@ final class HTTPBodyOutputStreamBridge: NSObject, StreamDelegate {
3838
3939 deinit {
4040 debug ( " Output stream delegate deinit " )
41- self . outputStream. delegate = nil
41+ outputStream. delegate = nil
4242 }
4343
4444 func performAction( _ action: State . Action ) {
@@ -48,7 +48,7 @@ final class HTTPBodyOutputStreamBridge: NSObject, StreamDelegate {
4848 case . none: return
4949 case . resumeProducer( let producerContinuation) :
5050 producerContinuation. resume ( )
51- performAction ( self . state. resumedProducer ( ) )
51+ performAction ( state. resumedProducer ( ) )
5252 case . writeBytes( let chunk) : writePendingBytes ( chunk)
5353 case . cancelProducerAndCloseStream( let producerContinuation) :
5454 producerContinuation. resume ( throwing: CancellationError ( ) )
@@ -75,31 +75,28 @@ final class HTTPBodyOutputStreamBridge: NSObject, StreamDelegate {
7575 self . performAction ( self . state. wroteFinalChunk ( ) )
7676 }
7777 }
78- self . performAction ( self . state. startedProducerTask ( task) )
78+ performAction ( state. startedProducerTask ( task) )
7979 }
8080
8181 private func writePendingBytes( _ bytesToWrite: Chunk ) {
8282 dispatchPrecondition ( condition: . onQueue( Self . streamQueue) )
8383 precondition ( !bytesToWrite. isEmpty, " \( #function) must be called with non-empty bytes " )
8484 guard outputStream. streamStatus == . open else {
8585 debug ( " Output stream closed unexpectedly. " )
86- performAction ( self . state. wroteBytes ( numBytesWritten: 0 , streamStillHasSpaceAvailable: false ) )
86+ performAction ( state. wroteBytes ( numBytesWritten: 0 , streamStillHasSpaceAvailable: false ) )
8787 return
8888 }
8989 switch bytesToWrite. withUnsafeBytes ( { outputStream. write ( $0. baseAddress!, maxLength: bytesToWrite. count) } ) {
9090 case 0 :
9191 debug ( " Output stream delegate reached end of stream when writing. " )
92- performAction ( self . state. endEncountered ( ) )
92+ performAction ( state. endEncountered ( ) )
9393 case - 1 :
9494 debug ( " Output stream delegate encountered error writing to stream: \( outputStream. streamError!) . " )
95- performAction ( self . state. errorOccurred ( outputStream. streamError!) )
95+ performAction ( state. errorOccurred ( outputStream. streamError!) )
9696 case let written where written > 0 :
9797 debug ( " Output stream delegate wrote \( written) bytes to stream. " )
9898 performAction (
99- self . state. wroteBytes (
100- numBytesWritten: written,
101- streamStillHasSpaceAvailable: outputStream. hasSpaceAvailable
102- )
99+ state. wroteBytes ( numBytesWritten: written, streamStillHasSpaceAvailable: outputStream. hasSpaceAvailable)
103100 )
104101 default : preconditionFailure ( " OutputStream.write(_:maxLength:) returned undocumented value " )
105102 }
@@ -115,9 +112,9 @@ final class HTTPBodyOutputStreamBridge: NSObject, StreamDelegate {
115112 return
116113 }
117114 startWriterTask ( )
118- case . hasSpaceAvailable: performAction ( self . state. spaceBecameAvailable ( ) )
119- case . errorOccurred: performAction ( self . state. errorOccurred ( stream. streamError!) )
120- case . endEncountered: performAction ( self . state. endEncountered ( ) )
115+ case . hasSpaceAvailable: performAction ( state. spaceBecameAvailable ( ) )
116+ case . errorOccurred: performAction ( state. errorOccurred ( stream. streamError!) )
117+ case . endEncountered: performAction ( state. endEncountered ( ) )
121118 default :
122119 debug ( " Output stream ignoring event: \( event) . " )
123120 break
0 commit comments