File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 11import Foundation
22import NIOCore
33
4+ #if canImport(Darwin)
5+ import Darwin
6+ #elseif canImport(Glibc)
7+ import Glibc
8+ #elseif canImport(Musl)
9+ import Musl
10+ #endif
11+
412extension NIOBSDSocket . Option {
513 #if canImport(Darwin)
614 public static let ip_bound_if : NIOBSDSocket . Option = Self ( rawValue: IP_BOUND_IF)
715 public static let ipv6_bound_if : NIOBSDSocket . Option = Self ( rawValue: IPV6_BOUND_IF)
8- #elseif canImport(Glibc)
16+ #elseif canImport(Glibc) || canImport(Musl)
917 public static let so_bindtodevice = Self ( rawValue: SO_BINDTODEVICE)
1018 #endif
1119}
1220
1321extension SocketOptionProvider {
14- #if canImport(Glibc)
22+ #if canImport(Glibc) || canImport(Musl)
1523 /// Sets the socket option SO_BINDTODEVICE to `value`.
1624 ///
1725 /// - parameters:
Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ public final class WebSocketClient: Sendable {
181181 default :
182182 return channel. eventLoop. makeFailedFuture ( WebSocketClient . Error. invalidAddress)
183183 }
184- #elseif canImport(Glibc)
184+ #elseif canImport(Glibc) || canImport(Musl)
185185 return ( channel as! SocketOptionProvider ) . setBindToDevice ( device. name)
186186 #endif
187187 } else {
You can’t perform that action at this time.
0 commit comments