Rename `NIOTSDatagramBootstrap` to `NIOTSDatagramConnectionBootstrap`
This commit is contained in:
parent
3c3b6f10d4
commit
9c21857310
|
|
@ -17,9 +17,13 @@ import NIOCore
|
|||
import Dispatch
|
||||
import Network
|
||||
|
||||
/// A `NIOTSDatagramBootstrap` is an easy way to bootstrap a `NIOTSDatagramConnectionChannel` when creating network clients.
|
||||
@available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
|
||||
@available(*, deprecated, renamed: "NIOTSDatagramConnectionBootstrap")
|
||||
public typealias NIOTSDatagramBootstrap = NIOTSDatagramConnectionBootstrap
|
||||
|
||||
/// A `NIOTSDatagramConnectionBootstrap` is an easy way to bootstrap a `NIOTSDatagramConnectionChannel` when creating network clients.
|
||||
///
|
||||
/// Usually you re-use a `NIOTSDatagramBootstrap` once you set it up, calling `connect` multiple times on the same bootstrap.
|
||||
/// Usually you re-use a `NIOTSDatagramConnectionBootstrap` once you set it up, calling `connect` multiple times on the same bootstrap.
|
||||
/// This way you ensure that the same `EventLoop`s will be shared across all your connections.
|
||||
///
|
||||
/// Example:
|
||||
|
|
@ -29,7 +33,7 @@ import Network
|
|||
/// defer {
|
||||
/// try! group.syncShutdownGracefully()
|
||||
/// }
|
||||
/// let bootstrap = NIOTSDatagramBootstrap(group: group)
|
||||
/// let bootstrap = NIOTSDatagramConnectionBootstrap(group: group)
|
||||
/// .channelInitializer { channel in
|
||||
/// channel.pipeline.addHandler(MyChannelHandler())
|
||||
/// }
|
||||
|
|
@ -39,7 +43,7 @@ import Network
|
|||
///
|
||||
/// The connected `NIOTSDatagramConnectionChannel` will operate on `ByteBuffer` as inbound and outbound messages.
|
||||
@available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
|
||||
public final class NIOTSDatagramBootstrap {
|
||||
public final class NIOTSDatagramConnectionBootstrap {
|
||||
private let group: EventLoopGroup
|
||||
private var channelInitializer: (@Sendable (Channel) -> EventLoopFuture<Void>)?
|
||||
private var connectTimeout: TimeAmount = TimeAmount.seconds(10)
|
||||
|
|
@ -229,5 +233,5 @@ public final class NIOTSDatagramBootstrap {
|
|||
}
|
||||
|
||||
@available(*, unavailable)
|
||||
extension NIOTSDatagramBootstrap: Sendable {}
|
||||
extension NIOTSDatagramConnectionBootstrap: Sendable {}
|
||||
#endif
|
||||
|
|
@ -142,7 +142,7 @@ final class NIOTSDatagramBootstrapTests: XCTestCase {
|
|||
host: String = "127.0.0.1",
|
||||
port: Int
|
||||
) throws -> Channel {
|
||||
try NIOTSDatagramBootstrap(group: group)
|
||||
try NIOTSDatagramConnectionBootstrap(group: group)
|
||||
.channelInitializer { channel in
|
||||
channel.eventLoop.makeCompletedFuture {
|
||||
try channel.pipeline.syncOperations.addHandler(
|
||||
|
|
@ -219,7 +219,7 @@ final class NIOTSDatagramBootstrapTests: XCTestCase {
|
|||
XCTAssertNoThrow(try listener.close().wait())
|
||||
}
|
||||
|
||||
let connection = try! NIOTSDatagramBootstrap(group: self.group)
|
||||
let connection = try! NIOTSDatagramConnectionBootstrap(group: self.group)
|
||||
.channelInitializer { channel in
|
||||
testSyncOptions(channel)
|
||||
return channel.eventLoop.makeSucceededVoidFuture()
|
||||
|
|
@ -257,7 +257,7 @@ final class NIOTSDatagramBootstrapTests: XCTestCase {
|
|||
.bind(host: "localhost", port: 0)
|
||||
.get()
|
||||
|
||||
let connectionChannel: Channel = try await NIOTSDatagramBootstrap(group: group)
|
||||
let connectionChannel: Channel = try await NIOTSDatagramConnectionBootstrap(group: group)
|
||||
.configureNWParameters { _ in
|
||||
configuratorClientConnectionCounter.withLockedValue { $0 += 1 }
|
||||
}
|
||||
|
|
@ -292,7 +292,7 @@ final class NIOTSDatagramBootstrapTests: XCTestCase {
|
|||
XCTAssertNoThrow(try listener.close().wait())
|
||||
}
|
||||
|
||||
_ = try NIOTSDatagramBootstrap(group: self.group)
|
||||
_ = try NIOTSDatagramConnectionBootstrap(group: self.group)
|
||||
.channelInitializer { channel in
|
||||
let conn = try! channel.syncOptions!.getOption(NIOTSChannelOptions.connection)
|
||||
XCTAssertNil(conn)
|
||||
|
|
|
|||
Loading…
Reference in New Issue