From ef8d727ca0eb346af951d15d84ba6f2b9564adf5 Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Wed, 23 Apr 2014 20:34:14 +0200 Subject: [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 Signed-off-by: Mattijs Korpershoek --- remote-processor/Message.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'remote-processor/Message.h') diff --git a/remote-processor/Message.h b/remote-processor/Message.h index 799a525..4f22977 100644 --- a/remote-processor/Message.h +++ b/remote-processor/Message.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2011-2014, Intel Corporation * All rights reserved. * @@ -43,8 +43,17 @@ public: CMessage(); virtual ~CMessage(); - // Send/Receive - bool serialize(CSocket* pSocket, bool bOut); + /** Write or read the message on pSocket. + * + * @param[in,out] pSocket is the socket on wich IO operation will be made. + * @param[in] bOut if true message should be read, + * if false it should be written. + * @param[out] strError on failure, a string explaining the error, + * on success, undefined. + * + * @return true on success, false on failure. + */ + bool serialize(CSocket* pSocket, bool bOut, std::string &strError); protected: // Msg Id -- cgit v1.1 From e874c2575c1203648e71426cd34f747cbd34b2b4 Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Fri, 25 Apr 2014 15:11:12 +0200 Subject: remote-proccessor detect partial message reception BZ: 190038 Client disconnection during message reception is normal if no part of the message as been receive yet. Client disconnection in the middle of a packet reception is not normal but was not differentiated from the behaviour described above. Do not consider client disconnection on first read as an error. Consider it as an error on the followings. Change-Id: I34b50ba0af800f9e1fcdb51996b1b2f02a23cb3f Signed-off-by: Kevin Rocard Signed-off-by: Mattijs Korpershoek --- remote-processor/Message.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'remote-processor/Message.h') diff --git a/remote-processor/Message.h b/remote-processor/Message.h index 4f22977..feafc83 100644 --- a/remote-processor/Message.h +++ b/remote-processor/Message.h @@ -43,6 +43,12 @@ public: CMessage(); virtual ~CMessage(); + enum Result { + success, + peerDisconnected, + error + }; + /** Write or read the message on pSocket. * * @param[in,out] pSocket is the socket on wich IO operation will be made. @@ -51,9 +57,11 @@ public: * @param[out] strError on failure, a string explaining the error, * on success, undefined. * - * @return true on success, false on failure. + * @return success if a correct message could be recv/send + * peerDisconnected if the peer disconnected before the first socket access. + * error if the message could not be read/write for any other reason */ - bool serialize(CSocket* pSocket, bool bOut, std::string &strError); + Result serialize(CSocket* pSocket, bool bOut, std::string &strError); protected: // Msg Id -- cgit v1.1