Closed andreasley closed 8 years ago
Looks like Travis is complaining:
/home/travis/build/vapor/socks/Tests/SocksCoreTests/OptionsTests.swift:43:59: error: use of unresolved identifier 'SOL_SOCKET'
guard case ErrorReason.optionGetFailed(level: SOL_SOCKET, name: SO_SNDTIMEO, type: "timeval") = error.type else {
^~~~~~~~~~
SwiftGlibc.SOL_SOCKET:1:12: note: did you mean 'SOL_SOCKET'?
public var SOL_SOCKET: Int32 { get }
^
/home/travis/build/vapor/socks/Tests/SocksCoreTests/OptionsTests.swift:43:77: error: use of unresolved identifier 'SO_SNDTIMEO'
guard case ErrorReason.optionGetFailed(level: SOL_SOCKET, name: SO_SNDTIMEO, type: "timeval") = error.type else {
^~~~~~~~~~~
SwiftGlibc.SO_SNDTIMEO:1:12: note: did you mean 'SO_SNDTIMEO'?
public var SO_SNDTIMEO: Int32 { get }
@tannernelson this looks good to me can you take a look at getting it in. @andreasley you're doing some amazing work on these lower level libraries, thanks so much for the additions!
Thanks @andreasley
In certain circumstances,
setsockopt()
andgetsockopt()
can fail (e.g. when the socket is already closed). The current version correctly detects that, but the properties for the options would force-try anyway and end up with a crash. This PR deprecates the properties in favor of throwing funcs.