diff --git a/Sources/NIO/BaseSocket.swift b/Sources/NIO/BaseSocket.swift index 0ebd2fba8..db217f012 100644 --- a/Sources/NIO/BaseSocket.swift +++ b/Sources/NIO/BaseSocket.swift @@ -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 } }