need to use return value of recvmsg for length of received data

This commit is contained in:
Christian Ulrich 2020-06-13 12:33:00 +02:00
parent 2f49216e15
commit fd1ec1aeaa
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 3 additions and 1 deletions

View File

@ -138,7 +138,9 @@ proc asyncRecvMsg*(fd: AsyncFD,
retFuture.fail(newException(ValueError, "unexpected ancillary data"))
return
dataBuffer.setLen(msg.msg_iov.iov_len)
# FIXME: This will not work on FreeBSD as recvmsg(2) says:
# recvmmsg() returns the number of messages received
dataBuffer.setLen(res)
retFuture.complete((dataBuffer, ancillaryData))
addRead(fd, cb)