File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 14
14
15
15
import Foundation
16
16
import NIO
17
+ import NIOConcurrencyHelpers
17
18
import NIOFoundationCompat
18
19
@testable import NIOHTTP1
19
20
@testable import NIOHTTPClient
@@ -405,15 +406,25 @@ class SwiftHTTPTests: XCTestCase {
405
406
class BackpressureTestDelegate : HTTPClientResponseDelegate {
406
407
typealias Response = Void
407
408
408
- var reads = 0
409
+ var _reads = 0
410
+ let lock : Lock
409
411
let promise : EventLoopPromise < Void >
410
412
411
413
init ( promise: EventLoopPromise < Void > ) {
414
+ self . lock = Lock ( )
412
415
self . promise = promise
413
416
}
414
417
418
+ var reads : Int {
419
+ return self . lock. withLock {
420
+ self . _reads
421
+ }
422
+ }
423
+
415
424
func didReceivePart( task: HTTPClient . Task < Response > , _ buffer: ByteBuffer ) -> EventLoopFuture < Void > {
416
- self . reads += 1
425
+ self . lock. withLockVoid {
426
+ self . _reads += 1
427
+ }
417
428
return self . promise. futureResult
418
429
}
419
430
You can’t perform that action at this time.
0 commit comments