Skip to content

Commit 4d8b475

Browse files
committed
Soundness
1 parent 1a51229 commit 4d8b475

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Sources/AsyncHTTPClient/ConnectionPool/HTTP2/HTTP2Connection.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,11 @@ final class HTTP2Connection {
278278
// inform the idle connection handler, that connection should be closed, once all streams
279279
// are closed.
280280
self.channel.triggerUserOutboundEvent(HTTPConnectionEvent.shutdownRequested, promise: nil)
281-
281+
282282
case .closed, .closing:
283283
// we are already closing/closed and we need to tolerate this
284284
break
285-
285+
286286
case .initialized, .starting:
287287
preconditionFailure("invalid state \(self.state)")
288288
}

Tests/AsyncHTTPClientTests/HTTP2ConnectionTests+XCTest.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ extension HTTP2ConnectionTests {
2626
static var allTests: [(String, (HTTP2ConnectionTests) -> () throws -> Void)] {
2727
return [
2828
("testCreateNewConnectionFailureClosedIO", testCreateNewConnectionFailureClosedIO),
29+
("testConnectionToleratesShutdownEventsAfterAlreadyClosed", testConnectionToleratesShutdownEventsAfterAlreadyClosed),
2930
("testSimpleGetRequest", testSimpleGetRequest),
3031
("testEveryDoneRequestLeadsToAStreamAvailableCall", testEveryDoneRequestLeadsToAStreamAvailableCall),
3132
("testCancelAllRunningRequests", testCancelAllRunningRequests),

Tests/AsyncHTTPClientTests/HTTP2ConnectionTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ class HTTP2ConnectionTests: XCTestCase {
4141
logger: logger
4242
).wait())
4343
}
44-
44+
4545
func testConnectionToleratesShutdownEventsAfterAlreadyClosed() {
4646
let embedded = EmbeddedChannel()
4747
XCTAssertNoThrow(try embedded.connect(to: SocketAddress(ipAddress: "127.0.0.1", port: 3000)).wait())
48-
48+
4949
let logger = Logger(label: "test.http2.connection")
5050
let connection = HTTP2Connection(
5151
channel: embedded,
@@ -55,11 +55,11 @@ class HTTP2ConnectionTests: XCTestCase {
5555
logger: logger
5656
)
5757
_ = connection.start()
58-
58+
5959
XCTAssertNoThrow(try embedded.close().wait())
6060
// to really destroy the channel we need to tick once
6161
embedded.embeddedEventLoop.run()
62-
62+
6363
// should not crash
6464
connection.shutdown()
6565
}

0 commit comments

Comments
 (0)