NIO: invalid sockets are not `-1` but `INVALID_SOCKET` (#1660)
Adjust the sentinel indicating an invalid socket. Co-authored-by: Cory Benfield <lukasa@apple.com>
This commit is contained in:
parent
bc328cd3a8
commit
0ae9524ca8
|
@ -475,7 +475,11 @@ class BaseSocket: BaseSocketProtocol {
|
|||
/// - throws: An `IOError` if the operation failed.
|
||||
final func takeDescriptorOwnership() throws -> NIOBSDSocket.Handle {
|
||||
return try self.withUnsafeHandle {
|
||||
#if os(Windows)
|
||||
self.descriptor = INVALID_SOCKET
|
||||
#else
|
||||
self.descriptor = -1
|
||||
#endif
|
||||
return $0
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue