drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From par...@apache.org
Subject drill git commit: DRILL-5659: Fix error code checking in reading from socket This closes #876
Date Mon, 17 Jul 2017 20:23:55 GMT
Repository: drill
Updated Branches:
  refs/heads/master da9f09a3c -> 8d659ff70


DRILL-5659: Fix error code checking in reading from socket
 This closes #876


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/8d659ff7
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/8d659ff7
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/8d659ff7

Branch: refs/heads/master
Commit: 8d659ff7045337ec6a041e1cb37c45c6460ff168
Parents: da9f09a
Author: Parth Chandra <parthc@apache.org>
Authored: Wed Jul 12 14:39:17 2017 -0700
Committer: Parth Chandra <parthc@apache.org>
Committed: Mon Jul 17 13:23:22 2017 -0700

----------------------------------------------------------------------
 .../native/client/src/clientlib/drillClientImpl.cpp  | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/8d659ff7/contrib/native/client/src/clientlib/drillClientImpl.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/drillClientImpl.cpp b/contrib/native/client/src/clientlib/drillClientImpl.cpp
index 3f9f958..c5ef1a2 100644
--- a/contrib/native/client/src/clientlib/drillClientImpl.cpp
+++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp
@@ -252,12 +252,14 @@ void DrillClientImpl::doWriteToSocket(const char* dataPtr, size_t bytesToWrite,
     while(1) {
         size_t bytesWritten = m_socket.write_some(boost::asio::buffer(dataPtr, bytesToWrite),
errorCode);
 
+        if(errorCode && boost::asio::error::interrupted != errorCode){
+            break;
+        } 
+
         // Update the state
         bytesToWrite -= bytesWritten;
         dataPtr += bytesWritten;
 
-        if(EINTR != errorCode.value()) break;
-
         // Check if all the data is written then break from loop
         if(0 == bytesToWrite) break;
     }
@@ -412,17 +414,22 @@ void DrillClientImpl::doReadFromSocket(ByteBuf_t inBuf, size_t bytesToRead,
         return;
     }
 
+    DRILL_MT_LOG(DRILL_LOG(LOG_TRACE) << "Socket read: reading " << bytesToRead
<< "data bytes" << std::endl;)
     // Read all the bytes. In case when all the bytes were not read the proper
     // errorCode will be set.
     while(1){
         size_t dataBytesRead = m_socket.read_some(boost::asio::buffer(inBuf, bytesToRead),
                                            errorCode);
+        // Check if errorCode is EINTR then just retry otherwise break from loop
+        if(errorCode && boost::asio::error::interrupted != errorCode){
+            break;
+        } 
+
+        DRILL_MT_LOG(DRILL_LOG(LOG_TRACE) << "Socket read: actual bytes read = " <<
dataBytesRead << std::endl;)
         // Update the state
         bytesToRead -= dataBytesRead;
         inBuf += dataBytesRead;
 
-        // Check if errorCode is EINTR then just retry otherwise break from loop
-        if(EINTR != errorCode.value()) break;
 
         // Check if all the data is read then break from loop
         if(0 == bytesToRead) break;


Mime
View raw message