DRILL-1361: C++ Client needs a better error message when the handshake fails.
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/363d30b5
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/363d30b5
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/363d30b5
Branch: refs/heads/master
Commit: 363d30b54255840daa46959e1f7d8b2a779fa692
Parents: 4304b25
Author: Parth Chandra <pchandra@maprtech.com>
Authored: Fri Jan 2 15:22:31 2015 -0800
Committer: Parth Chandra <pchandra@maprtech.com>
Committed: Tue Jan 6 17:30:46 2015 -0800
----------------------------------------------------------------------
contrib/native/client/src/clientlib/drillClientImpl.cpp | 7 ++++++-
contrib/native/client/src/clientlib/errmsgs.cpp | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/363d30b5/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 6f4a2ca..84aa6cd 100644
--- a/contrib/native/client/src/clientlib/drillClientImpl.cpp
+++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp
@@ -230,7 +230,12 @@ void DrillClientImpl::handleHandshake(ByteBuf_t _buf,
}else{
// boost error
- handleConnError(CONN_FAILURE, getMessage(ERR_CONN_RDFAIL, error.message().c_str()));
+ if(error==boost::asio::error::eof){ // Server broke off the connection
+ handleConnError(CONN_HANDSHAKE_FAILED,
+ getMessage(ERR_CONN_NOHSHAKE, DRILL_RPC_VERSION, m_handshakeVersion));
+ }else{
+ handleConnError(CONN_FAILURE, getMessage(ERR_CONN_RDFAIL, error.message().c_str()));
+ }
return;
}
return;
http://git-wip-us.apache.org/repos/asf/drill/blob/363d30b5/contrib/native/client/src/clientlib/errmsgs.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/errmsgs.cpp b/contrib/native/client/src/clientlib/errmsgs.cpp
index e09bda1..a5e7217 100644
--- a/contrib/native/client/src/clientlib/errmsgs.cpp
+++ b/contrib/native/client/src/clientlib/errmsgs.cpp
@@ -29,7 +29,7 @@ static Drill::ErrorMessages errorMessages[]={
{ERR_CONN_FAILURE, ERR_CATEGORY_CONN, 0, "Connection failure. Host:%s port:%s. Error:
%s."},
{ERR_CONN_EXCEPT, ERR_CATEGORY_CONN, 0, "Socket connection failure with the following
exception: %s."},
{ERR_CONN_UNKPROTO, ERR_CATEGORY_CONN, 0, "Unknown protocol: %s."},
- {ERR_CONN_RDFAIL, ERR_CATEGORY_CONN, 0, "A socket read failed with error: %s."},
+ {ERR_CONN_RDFAIL, ERR_CATEGORY_CONN, 0, "Connection failed with error: %s."},
{ERR_CONN_WFAIL, ERR_CATEGORY_CONN, 0, "Synchronous socket write failed with error: %s."},
{ERR_CONN_ZOOKEEPER, ERR_CATEGORY_CONN, 0, "Zookeeper error. %s"},
{ERR_CONN_NOHSHAKE, ERR_CATEGORY_CONN, 0, "Handshake failed: Expected RPC version %d,
got %d."},
|