@@ -201,7 +201,7 @@ struct MockConnectionPool {
201
201
if let required = request. requiredEventLoop, required !== self . eventLoop {
202
202
throw Errors . connectionDoesNotFulfillEventLoopRequirement
203
203
}
204
- if used + 1 > maxStreams {
204
+ if used >= maxStreams {
205
205
throw Errors . connectionDoesNotHaveHTTP2StreamAvailable
206
206
}
207
207
self . state = . http2( . inUse( maxConcurrentStreams: maxStreams, used: used + 1 ) )
@@ -256,7 +256,7 @@ struct MockConnectionPool {
256
256
self . connections. values. filter { $0. isParked } . count
257
257
}
258
258
259
- var leased : Int {
259
+ var used : Int {
260
260
self . connections. values. filter { $0. isUsed } . count
261
261
}
262
262
@@ -411,28 +411,28 @@ struct MockConnectionPool {
411
411
}
412
412
413
413
extension MockConnectionPool {
414
- mutating func randomStartingConnection( ) -> Connection . ID ? {
414
+ func randomStartingConnection( ) -> Connection . ID ? {
415
415
self . connections. values
416
416
. filter { $0. isStarting }
417
417
. randomElement ( )
418
418
. map ( \. id)
419
419
}
420
420
421
- mutating func randomActiveConnection( ) -> Connection . ID ? {
421
+ func randomActiveConnection( ) -> Connection . ID ? {
422
422
self . connections. values
423
423
. filter { $0. isUsed || $0. isParked }
424
424
. randomElement ( )
425
425
. map ( \. id)
426
426
}
427
427
428
- mutating func randomParkedConnection( ) -> Connection ? {
428
+ func randomParkedConnection( ) -> Connection ? {
429
429
self . connections. values
430
430
. filter { $0. isParked }
431
431
. randomElement ( )
432
432
. flatMap { . __testOnly_connection( id: $0. id, eventLoop: $0. eventLoop) }
433
433
}
434
434
435
- mutating func randomLeasedConnection( ) -> Connection ? {
435
+ func randomLeasedConnection( ) -> Connection ? {
436
436
self . connections. values
437
437
. filter { $0. isUsed }
438
438
. randomElement ( )
0 commit comments