NIOPosix: adjust precondition for Windows (#2183)

The member names are not identical across platforms.  Add a case to
handle the name difference on Windows.

Co-authored-by: Cory Benfield <lukasa@apple.com>
This commit is contained in:
Saleem Abdulrasool 2022-06-10 09:14:27 -07:00 committed by GitHub
parent 01b13a5675
commit e0df87c5c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -172,7 +172,11 @@ struct DatagramVectorReadManager {
totalReadSize += readBytes totalReadSize += readBytes
// Next we extract the remote peer address. // Next we extract the remote peer address.
#if os(Windows)
precondition(self.messageVector[i].msg_hdr.namelen != 0, "Unexpected zero length peer name")
#else
precondition(self.messageVector[i].msg_hdr.msg_namelen != 0, "Unexpected zero length peer name") precondition(self.messageVector[i].msg_hdr.msg_namelen != 0, "Unexpected zero length peer name")
#endif
let address: SocketAddress = self.sockaddrVector[i].convert() let address: SocketAddress = self.sockaddrVector[i].convert()
// Extract congestion information if requested. // Extract congestion information if requested.