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:
Saleem AbdulrasoolandCory Benfield authored and GitHub committed 2020-09-30 10:32:52 +01:00
1 parent bc328cd3a8
commit 0ae9524ca8
1 file changed
+4
+4
View File
@@ -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
}
}