From af93fbea7026a0fef34874b2a8d67d4779983f68 Mon Sep 17 00:00:00 2001 From: Si Beaumont Date: Thu, 21 Apr 2022 19:42:38 +0100 Subject: [PATCH] fixup: cleanup bootstrap APIs Signed-off-by: Si Beaumont --- Sources/NIOPosix/Bootstrap.swift | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/Sources/NIOPosix/Bootstrap.swift b/Sources/NIOPosix/Bootstrap.swift index 36cda4516..8788178cd 100644 --- a/Sources/NIOPosix/Bootstrap.swift +++ b/Sources/NIOPosix/Bootstrap.swift @@ -919,8 +919,6 @@ public final class DatagramBootstrap { /// - parameters: /// - host: The host to connect to. /// - port: The port to connect to. - /// - /// - NOTE: This function is specifically for connected-mode UDP and does not call `bind`. public func connect(host: String, port: Int) -> EventLoopFuture { return connect0 { return try SocketAddress.makeAddressResolvingHost(host, port: port) @@ -931,8 +929,6 @@ public final class DatagramBootstrap { /// /// - parameters: /// - address: The `SocketAddress` to connect to. - /// - /// - NOTE: This function is specifically for connected-mode UDP and does not call `bind`. public func connect(to address: SocketAddress) -> EventLoopFuture { return connect0 { address } } @@ -942,28 +938,11 @@ public final class DatagramBootstrap { /// - parameters: /// - unixDomainSocketPath: The path of the UNIX Domain Socket to connect to. `path` must not exist, it will be created by the system. public func connect(unixDomainSocketPath: String) -> EventLoopFuture { - return bind0 { + return connect0 { return try SocketAddress(unixDomainSocketPath: unixDomainSocketPath) } } - /// Connect the `DatagramChannel` to a UNIX Domain Socket. - /// - /// - parameters: - /// - unixDomainSocketPath: The path of the UNIX Domain Socket to connect to. `path` must not exist, it will be created by the system. - /// - cleanupExistingSocketFile: Whether to cleanup an existing socket file at `path`. - public func connect(unixDomainSocketPath: String, cleanupExistingSocketFile: Bool) -> EventLoopFuture { - if cleanupExistingSocketFile { - do { - try BaseSocket.cleanupSocket(unixDomainSocketPath: unixDomainSocketPath) - } catch { - return group.next().makeFailedFuture(error) - } - } - - return self.bind(unixDomainSocketPath: unixDomainSocketPath) - } - private func connect0(_ makeSocketAddress: () throws -> SocketAddress) -> EventLoopFuture { let address: SocketAddress do {