Skip to content

Commit 322fd45

Browse files
committed
Small fixes
1 parent 054fca8 commit 322fd45

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: Tests/AsyncHTTPClientTests/Mocks/MockConnectionPool.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ struct MockConnectionPool {
201201
if let required = request.requiredEventLoop, required !== self.eventLoop {
202202
throw Errors.connectionDoesNotFulfillEventLoopRequirement
203203
}
204-
if used + 1 > maxStreams {
204+
if used >= maxStreams {
205205
throw Errors.connectionDoesNotHaveHTTP2StreamAvailable
206206
}
207207
self.state = .http2(.inUse(maxConcurrentStreams: maxStreams, used: used + 1))
@@ -256,7 +256,7 @@ struct MockConnectionPool {
256256
self.connections.values.filter { $0.isParked }.count
257257
}
258258

259-
var leased: Int {
259+
var used: Int {
260260
self.connections.values.filter { $0.isUsed }.count
261261
}
262262

@@ -411,28 +411,28 @@ struct MockConnectionPool {
411411
}
412412

413413
extension MockConnectionPool {
414-
mutating func randomStartingConnection() -> Connection.ID? {
414+
func randomStartingConnection() -> Connection.ID? {
415415
self.connections.values
416416
.filter { $0.isStarting }
417417
.randomElement()
418418
.map(\.id)
419419
}
420420

421-
mutating func randomActiveConnection() -> Connection.ID? {
421+
func randomActiveConnection() -> Connection.ID? {
422422
self.connections.values
423423
.filter { $0.isUsed || $0.isParked }
424424
.randomElement()
425425
.map(\.id)
426426
}
427427

428-
mutating func randomParkedConnection() -> Connection? {
428+
func randomParkedConnection() -> Connection? {
429429
self.connections.values
430430
.filter { $0.isParked }
431431
.randomElement()
432432
.flatMap { .__testOnly_connection(id: $0.id, eventLoop: $0.eventLoop) }
433433
}
434434

435-
mutating func randomLeasedConnection() -> Connection? {
435+
func randomLeasedConnection() -> Connection? {
436436
self.connections.values
437437
.filter { $0.isUsed }
438438
.randomElement()

0 commit comments

Comments
 (0)