DRILL-1045: C++ Client Properly shutdown sockets
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/69a07888 Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/69a07888 Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/69a07888 Branch: refs/heads/master Commit: 69a07888f5629b9871d4d2214926c1643706572f Parents: a299123 Author: norrislee <[email protected]> Authored: Thu Jun 19 18:12:25 2014 -0700 Committer: Jacques Nadeau <[email protected]> Committed: Wed Jun 25 17:55:54 2014 -0700 ---------------------------------------------------------------------- contrib/native/client/src/clientlib/drillClientImpl.cpp | 2 ++ contrib/native/client/src/clientlib/drillClientImpl.hpp | 4 ++++ 2 files changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/69a07888/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 71c2f78..6a29d88 100644 --- a/contrib/native/client/src/clientlib/drillClientImpl.cpp +++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp @@ -229,6 +229,8 @@ void DrillClientImpl::handleHShakeReadTimeout(const boost::system::error_code & // The deadline has passed. m_deadlineTimer.expires_at(boost::posix_time::pos_infin); DRILL_LOG(LOG_TRACE) << "Deadline timer expired." << std::endl; + boost::system::error_code ignorederr; + m_socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ignorederr); m_socket.close(); } } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/69a07888/contrib/native/client/src/clientlib/drillClientImpl.hpp ---------------------------------------------------------------------- diff --git a/contrib/native/client/src/clientlib/drillClientImpl.hpp b/contrib/native/client/src/clientlib/drillClientImpl.hpp index 23e0ef6..2bf7b5c 100644 --- a/contrib/native/client/src/clientlib/drillClientImpl.hpp +++ b/contrib/native/client/src/clientlib/drillClientImpl.hpp @@ -194,6 +194,8 @@ class DrillClientImpl{ m_deadlineTimer.cancel(); m_io_service.stop(); + boost::system::error_code ignorederr; + m_socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ignorederr); m_socket.close(); if(m_rbuf!=NULL){ Utils::freeBuffer(m_rbuf); m_rbuf=NULL; @@ -304,6 +306,8 @@ inline bool DrillClientImpl::Active() { inline void DrillClientImpl::Close() { //TODO: cancel pending query if(this->m_bIsConnected){ + boost::system::error_code ignorederr; + m_socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ignorederr); m_socket.close(); m_bIsConnected=false; }
