diff --git a/Sources/NIOCore/SocketOptionProvider.swift b/Sources/NIOCore/SocketOptionProvider.swift index 97f177298f..5c6e998fd9 100644 --- a/Sources/NIOCore/SocketOptionProvider.swift +++ b/Sources/NIOCore/SocketOptionProvider.swift @@ -75,7 +75,8 @@ public protocol SocketOptionProvider: _NIOPreconcurrencySendable { /// - value: The value to set the socket option to. /// - Returns: An `EventLoopFuture` that fires when the option has been set, /// or if an error has occurred. - func unsafeSetSocketOption( + @preconcurrency + func unsafeSetSocketOption( level: SocketOptionLevel, name: SocketOptionName, value: Value @@ -95,7 +96,8 @@ public protocol SocketOptionProvider: _NIOPreconcurrencySendable { /// - value: The value to set the socket option to. /// - Returns: An `EventLoopFuture` that fires when the option has been set, /// or if an error has occurred. - func unsafeSetSocketOption( + @preconcurrency + func unsafeSetSocketOption( level: NIOBSDSocket.OptionLevel, name: NIOBSDSocket.Option, value: Value @@ -114,7 +116,11 @@ public protocol SocketOptionProvider: _NIOPreconcurrencySendable { /// - name: The name of the socket option, e.g. `SO_REUSEADDR`. /// - Returns: An `EventLoopFuture` containing the value of the socket option, or /// any error that occurred while retrieving the socket option. - func unsafeGetSocketOption(level: SocketOptionLevel, name: SocketOptionName) -> EventLoopFuture + @preconcurrency + func unsafeGetSocketOption( + level: SocketOptionLevel, + name: SocketOptionName + ) -> EventLoopFuture #endif /// Obtain the value of the socket option for the given level and name. @@ -129,7 +135,8 @@ public protocol SocketOptionProvider: _NIOPreconcurrencySendable { /// - name: The name of the socket option, e.g. `SO_REUSEADDR`. /// - Returns: An `EventLoopFuture` containing the value of the socket option, or /// any error that occurred while retrieving the socket option. - func unsafeGetSocketOption( + @preconcurrency + func unsafeGetSocketOption( level: NIOBSDSocket.OptionLevel, name: NIOBSDSocket.Option ) -> EventLoopFuture @@ -137,7 +144,7 @@ public protocol SocketOptionProvider: _NIOPreconcurrencySendable { #if !os(Windows) extension SocketOptionProvider { - func unsafeSetSocketOption( + func unsafeSetSocketOption( level: NIOBSDSocket.OptionLevel, name: NIOBSDSocket.Option, value: Value @@ -149,7 +156,7 @@ extension SocketOptionProvider { ) } - func unsafeGetSocketOption( + func unsafeGetSocketOption( level: NIOBSDSocket.OptionLevel, name: NIOBSDSocket.Option ) -> EventLoopFuture { diff --git a/Sources/NIOPosix/BaseSocketChannel+SocketOptionProvider.swift b/Sources/NIOPosix/BaseSocketChannel+SocketOptionProvider.swift index c50429abd3..47eb8dd11e 100644 --- a/Sources/NIOPosix/BaseSocketChannel+SocketOptionProvider.swift +++ b/Sources/NIOPosix/BaseSocketChannel+SocketOptionProvider.swift @@ -15,7 +15,7 @@ import NIOCore extension BaseSocketChannel: SocketOptionProvider { #if !os(Windows) - func unsafeSetSocketOption( + func unsafeSetSocketOption( level: SocketOptionLevel, name: SocketOptionName, value: Value @@ -28,7 +28,7 @@ extension BaseSocketChannel: SocketOptionProvider { } #endif - func unsafeSetSocketOption( + func unsafeSetSocketOption( level: NIOBSDSocket.OptionLevel, name: NIOBSDSocket.Option, value: Value @@ -47,7 +47,10 @@ extension BaseSocketChannel: SocketOptionProvider { } #if !os(Windows) - func unsafeGetSocketOption(level: SocketOptionLevel, name: SocketOptionName) -> EventLoopFuture { + func unsafeGetSocketOption( + level: SocketOptionLevel, + name: SocketOptionName + ) -> EventLoopFuture { unsafeGetSocketOption( level: NIOBSDSocket.OptionLevel(rawValue: CInt(level)), name: NIOBSDSocket.Option(rawValue: CInt(name)) @@ -55,7 +58,7 @@ extension BaseSocketChannel: SocketOptionProvider { } #endif - func unsafeGetSocketOption( + func unsafeGetSocketOption( level: NIOBSDSocket.OptionLevel, name: NIOBSDSocket.Option ) -> EventLoopFuture {