From 3dd67addc686e490ac4b710250d1d5fca4ca0729 Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Thu, 24 Apr 2014 15:14:53 +0200 Subject: Remote-processor send returning 0 is not an error BZ: 190038 Send can return a 0 size, it is normal. Does not consider send return value 0 as an error. Change-Id: Ic4801908b0771d5e0aba8c090fb9e9949d6e16fc Signed-off-by: Kevin Rocard --- remote-processor/Socket.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'remote-processor') diff --git a/remote-processor/Socket.cpp b/remote-processor/Socket.cpp index d79b45a..3530453 100644 --- a/remote-processor/Socket.cpp +++ b/remote-processor/Socket.cpp @@ -111,6 +111,9 @@ bool CSocket::read(void* pvData, uint32_t uiSize) if (!iAccessedSize || iAccessedSize == -1) { + // recv return value is 0 when the peer has performed an orderly shutdown. + // -1 if an error occurred + // In both case the read could not be achieve return false; } uiSize -= iAccessedSize; @@ -129,7 +132,8 @@ bool CSocket::write(const void* pvData, uint32_t uiSize) int32_t iAccessedSize = ::send(_iSockFd, &pucData[uiOffset], uiSize, MSG_NOSIGNAL); - if (!iAccessedSize || iAccessedSize == -1) { + // Return value of 0 is not an error + if (iAccessedSize == -1) { return false; } -- cgit v1.1