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 1414
1515import  Foundation
1616import  NIO
17+ import  NIOConcurrencyHelpers
1718import  NIOFoundationCompat
1819@testable   import  NIOHTTP1
1920@testable   import  NIOHTTPClient
@@ -405,15 +406,25 @@ class SwiftHTTPTests: XCTestCase {
405406 class  BackpressureTestDelegate :  HTTPClientResponseDelegate  { 
406407 typealias  Response  =  Void 
407408
408-  var  reads =  0 
409+  var  _reads =  0 
410+  let  lock :  Lock 
409411 let  promise :  EventLoopPromise < Void > 
410412
411413 init ( promise:  EventLoopPromise < Void > )  { 
414+  self . lock =  Lock ( ) 
412415 self . promise =  promise
413416 } 
414417
418+  var  reads :  Int  { 
419+  return  self . lock. withLock  { 
420+  self . _reads
421+  } 
422+  } 
423+ 
415424 func  didReceivePart( task:  HTTPClient . Task < Response > ,  _ buffer:  ByteBuffer )  ->  EventLoopFuture < Void >  { 
416-  self . reads +=  1 
425+  self . lock. withLockVoid  { 
426+  self . _reads +=  1 
427+  } 
417428 return  self . promise. futureResult
418429 } 
419430
                         You can’t perform that action at this time. 
           
                  
0 commit comments