From fd1ec1aeaa7f810126be6371d44e387b815490f9 Mon Sep 17 00:00:00 2001 From: Christian Ulrich Date: Sat, 13 Jun 2020 12:33:00 +0200 Subject: [PATCH] need to use return value of recvmsg for length of received data --- asyncutils.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/asyncutils.nim b/asyncutils.nim index 5b9afc1..e010d71 100644 --- a/asyncutils.nim +++ b/asyncutils.nim @@ -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)