Skip to content

Commit ba76fe4

Browse files
committed
Rename start to start0
And wait for connection start to fail
1 parent 7775fa0 commit ba76fe4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Sources/AsyncHTTPClient/ConnectionPool/HTTP2/HTTP2Connection.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ final class HTTP2Connection {
129129
delegate: delegate,
130130
logger: logger
131131
)
132-
return connection.start().map { maxStreams in (connection, maxStreams) }
132+
return connection.start0().map { maxStreams in (connection, maxStreams) }
133133
}
134134

135135
func executeRequest(_ request: HTTPExecutableRequest) {
@@ -164,7 +164,7 @@ final class HTTP2Connection {
164164
return promise.futureResult
165165
}
166166

167-
func start() -> EventLoopFuture<Int> {
167+
func start0() -> EventLoopFuture<Int> {
168168
self.channel.eventLoop.assertInEventLoop()
169169

170170
let readyToAcceptConnectionsPromise = self.channel.eventLoop.makePromise(of: Int.self)

Tests/AsyncHTTPClientTests/HTTP2ConnectionTests.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ class HTTP2ConnectionTests: XCTestCase {
5454
delegate: TestHTTP2ConnectionDelegate(),
5555
logger: logger
5656
)
57-
_ = connection.start()
57+
let startFuture = connection.start0()
5858

5959
XCTAssertNoThrow(try embedded.close().wait())
6060
// to really destroy the channel we need to tick once
6161
embedded.embeddedEventLoop.run()
62+
63+
XCTAssertThrowsError(try startFuture.wait())
6264

6365
// should not crash
6466
connection.shutdown()

0 commit comments

Comments
 (0)