diff options
author | Kevin Rocard <kevinx.rocard@intel.com> | 2014-04-23 20:34:14 +0200 |
---|---|---|
committer | Mattijs Korpershoek <mattijsx.korpershoek@intel.com> | 2014-06-25 10:52:28 +0200 |
commit | ef8d727ca0eb346af951d15d84ba6f2b9564adf5 (patch) | |
tree | 533e493aa4814b12c3b49da7ee1ba5864b436042 /remote-processor/Socket.cpp | |
parent | f976f3749c6639915a646a88049fe523e3d5f051 (diff) | |
download | external_parameter-framework-ef8d727ca0eb346af951d15d84ba6f2b9564adf5.zip external_parameter-framework-ef8d727ca0eb346af951d15d84ba6f2b9564adf5.tar.gz external_parameter-framework-ef8d727ca0eb346af951d15d84ba6f2b9564adf5.tar.bz2 |
[remote-processor] Add context information on failure
BZ: 190038
Remote processor was not displaying information in case of network
read/write error.
Add some error messages to ease debug.
Change-Id: I465062e8cf77f94b3d4d4d0c71338c4630aac276
Signed-off-by: Kevin Rocard <kevinx.rocard@intel.com>
Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Diffstat (limited to 'remote-processor/Socket.cpp')
-rw-r--r-- | remote-processor/Socket.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/remote-processor/Socket.cpp b/remote-processor/Socket.cpp index 07e6b60..b36d32f 100644 --- a/remote-processor/Socket.cpp +++ b/remote-processor/Socket.cpp @@ -113,6 +113,8 @@ bool CSocket::read(void* pvData, uint32_t uiSize) switch (iAccessedSize) { case 0: // recv return value is 0 when the peer has performed an orderly shutdown. + _disconnected = true; + errno = ECONNRESET; // Warn the client that the client disconnected. return false; case -1: @@ -141,6 +143,10 @@ bool CSocket::write(const void* pvData, uint32_t uiSize) int32_t iAccessedSize = ::send(_iSockFd, &pucData[uiOffset], uiSize, MSG_NOSIGNAL); if (iAccessedSize == -1) { + if (errno == ECONNRESET) { + // Peer has disconnected + _disconnected = true; + } // errno == EINTR => The send system call was interrupted, try again if (errno != EINTR) { return false; @@ -158,3 +164,7 @@ int CSocket::getFd() const { return _iSockFd; } + +bool CSocket::hasPeerDisconnected() { + return _disconnected; +} |