From 563ad9e42d9c3935c6388d8fabc92f977b87bdb2 Mon Sep 17 00:00:00 2001 From: Boubacar DIENE Date: Sun, 9 Feb 2020 22:52:41 +0100 Subject: [PATCH] [DEV] Do not update nbBytesXxx variables when sendmsg/recvmsg failed --- src/network/LinkHelper.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/network/LinkHelper.c b/src/network/LinkHelper.c index cfd7047..4a2440b 100755 --- a/src/network/LinkHelper.c +++ b/src/network/LinkHelper.c @@ -745,8 +745,9 @@ static int8_t readData_f(struct link_helper_s *obj, struct link_s *src, struct l } pData->nbBytesReceived = 0; } - - pData->nbBytesReceived = (size_t)nbBytesReceived; + else { + pData->nbBytesReceived = (size_t)nbBytesReceived; + } if (pData->nbBytesReceived < buffer->length) { ssize_t nbBytes = 0; @@ -834,8 +835,9 @@ static int8_t writeData_f(struct link_helper_s *obj, struct link_s *src, struct } pData->nbBytesSent = 0; } - - pData->nbBytesSent = (size_t)nbBytesSent; + else { + pData->nbBytesSent = (size_t)nbBytesSent; + } if (pData->nbBytesSent < buffer->length) { uint8_t sendByBlock = (errno == EMSGSIZE);