Loading src/Client.cpp +30 −7 Original line number Diff line number Diff line Loading @@ -163,7 +163,7 @@ void Client::run() DEBUG_STREAM << "Client::run() interrupt" << endl; break; } } //while } } //============================================================================== Loading @@ -173,13 +173,18 @@ void Client::startResolve() { DEBUG_STREAM << "Client::startResolve()" << endl; std::stringstream infoStream; infoStream << "Resolving host: " << m_configuration_sp->getRemoteHost() << " port: " << m_configuration_sp->getRemotePort(); INFO_STREAM << "Client::startResolve() " << infoStream.str() << endl; writeState(Tango::ON); writeStatus(infoStream.str()); boost::asio::ip::tcp::resolver::query query(m_configuration_sp->getRemoteHost(), boost::lexical_cast<std::string>(m_configuration_sp->getRemotePort())); INFO_STREAM << "Client::startResolve() host: " << m_configuration_sp->getRemoteHost() << " port: " << m_configuration_sp->getRemotePort() << endl; m_resetConnectionTimer.expires_from_now(boost::posix_time::seconds(30)); m_resolver.async_resolve(query, boost::bind(&Client::handleResolve, this, Loading @@ -203,6 +208,9 @@ void Client::handleResolve(const boost::system::error_code& errorCode, else { ERROR_STREAM << "Client::handleResolve() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); } } Loading @@ -220,6 +228,9 @@ void Client::handleWriteRequest(const boost::system::error_code& errorCode) else { ERROR_STREAM << "Client::handleRequest() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); } } Loading @@ -239,6 +250,9 @@ void Client::handleReadResponseHeader(const boost::system::error_code& errorCode else { ERROR_STREAM << "Client::handleReadResponseHeader() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); } } Loading Loading @@ -268,15 +282,24 @@ void Client::handleReadResponseBody(const boost::system::error_code& errorCode) catch(std::runtime_error& ec) { ERROR_STREAM << "Client::handleResponse() " << ec.what() << endl; writeState(Tango::FAULT); writeStatus(ec.what()); } catch(...) { ERROR_STREAM << "Client::handleResponse() unknown error" << endl; ERROR_STREAM << "Client::handleResponse() Unknown error" << endl; writeState(Tango::FAULT); writeStatus("Unknown error"); } } else { ERROR_STREAM << "Client::handleResponse() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); } } Loading @@ -290,7 +313,7 @@ void Client::resetConnection() if(m_resetConnectionTimer.expires_at() <= boost::asio::deadline_timer::traits_type::now()) { INFO_STREAM << "CONNECTION RESET AFTER TIMEOUT" << endl; ERROR_STREAM << "Client::resetConnection() Connection timeout" << endl; closeConnection(); Loading src/PlainClient.cpp +31 −16 Original line number Diff line number Diff line Loading @@ -73,14 +73,12 @@ void PlainClient::startConnect(boost::asio::ip::tcp::resolver::iterator endPoint if(endPointIterator != boost::asio::ip::tcp::resolver::iterator()) { DEBUG_STREAM << "PlainClient::startConnect() connecting to " << endPointIterator->endpoint() << endl; std::stringstream infoStream; infoStream << "Connecting to " << endPointIterator->endpoint(); writeState(Tango::OFF); DEBUG_STREAM << "PlainClient::startConnect() " << infoStream.str() << endl; std::stringstream statusStream; statusStream << "Connecting to " << endPointIterator->endpoint(); writeStatus(statusStream.str()); writeStatus(infoStream.str()); m_plainSocket.async_connect(endPointIterator->endpoint(), boost::bind(&PlainClient::handleConnect, this, Loading @@ -89,6 +87,9 @@ void PlainClient::startConnect(boost::asio::ip::tcp::resolver::iterator endPoint else { ERROR_STREAM << "PlainClient::startConnect() no more endpoint" << endl; writeState(Tango::FAULT); writeStatus("No more endpoint"); } } Loading @@ -102,13 +103,12 @@ void PlainClient::handleConnect(const boost::system::error_code& errorCode, if(!errorCode) { INFO_STREAM << m_plainSocket.remote_endpoint() << " CONNECTED" << endl; std::stringstream infoStream; infoStream << "Connected to " << m_plainSocket.remote_endpoint(); writeState(Tango::ON); INFO_STREAM << "PlainClient::handleConnect() " << infoStream.str() << endl; std::stringstream statusStream; statusStream << "Connected to " << m_plainSocket.remote_endpoint(); writeStatus(statusStream.str()); writeStatus(infoStream.str()); startWriteRequest(); } Loading @@ -116,6 +116,9 @@ void PlainClient::handleConnect(const boost::system::error_code& errorCode, { ERROR_STREAM << "PlainClient::handleConnect() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); if(m_plainSocket.is_open()) m_plainSocket.close(); Loading @@ -136,8 +139,11 @@ void PlainClient::startWriteRequest() boost::uint32_t bodySize = request_sp->ByteSize(); INFO_STREAM << m_plainSocket.remote_endpoint() << " <<<< " << bodySize << " BYTE" << endl; #ifdef VERBOSE_DEBUG INFO_STREAM << "PlainClient::startRequest()" << m_plainSocket.remote_endpoint() << " <<<< " << bodySize << " byte" << endl; #endif std::vector<boost::uint8_t> writeBuff; writeBuff.resize(HEADER_SIZE + bodySize); Loading @@ -155,10 +161,16 @@ void PlainClient::startWriteRequest() catch(std::runtime_error& ec) { ERROR_STREAM << "PlainClient::startWriteRequest() " << ec.what() << endl; writeState(Tango::FAULT); writeStatus(ec.what()); } catch(...) { ERROR_STREAM << "PlainClient::startWriteRequest() unknown error" << endl; writeState(Tango::FAULT); writeStatus("Unknown error"); } } Loading @@ -185,8 +197,11 @@ void PlainClient::startReadResponseBody(boost::uint32_t bodySize) { DEBUG_STREAM << "PlainClient::startReadResponseBody()" << endl; INFO_STREAM << m_plainSocket.remote_endpoint() << " >>>> " << bodySize << " BYTE" << endl; #ifdef VERBOSE_DEBUG INFO_STREAM << "PlainClient::startReadResponseBody()" << m_plainSocket.remote_endpoint() << " >>>> " << bodySize << " byte" << endl; #endif m_readBuff.resize(HEADER_SIZE + bodySize); Loading src/SSLClient.cpp +34 −17 Original line number Diff line number Diff line Loading @@ -91,14 +91,12 @@ void SSLClient::startConnect(boost::asio::ip::tcp::resolver::iterator endPointIt if(endPointIterator != boost::asio::ip::tcp::resolver::iterator()) { DEBUG_STREAM << "SSLClient::startConnect() connecting to " << endPointIterator->endpoint() << endl; std::stringstream infoStream; infoStream << "Connecting to " << endPointIterator->endpoint(); writeState(Tango::OFF); INFO_STREAM << "SSLClient::startConnect() " << infoStream.str() << endl; std::stringstream statusStream; statusStream << "Connecting to " << endPointIterator->endpoint(); writeStatus(statusStream.str()); writeStatus(infoStream.str()); m_sSLSocket.lowest_layer().async_connect(endPointIterator->endpoint(), boost::bind(&SSLClient::handleConnect, this, Loading @@ -106,7 +104,10 @@ void SSLClient::startConnect(boost::asio::ip::tcp::resolver::iterator endPointIt } else { ERROR_STREAM << "PlainClient::startConnect() no more endpoint" << endl; ERROR_STREAM << "PlainClient::startConnect() No more endpoint" << endl; writeState(Tango::FAULT); writeStatus("No more endpoint"); } } Loading @@ -126,6 +127,9 @@ void SSLClient::handleConnect(const boost::system::error_code& errorCode, { ERROR_STREAM << "PlainClient::handleConnect() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); if(m_sSLSocket.lowest_layer().is_open()) m_sSLSocket.lowest_layer().close(); Loading Loading @@ -156,20 +160,21 @@ void SSLClient::handleHandShake(const boost::system::error_code& errorCode) if(!errorCode) { INFO_STREAM << m_sSLSocket.lowest_layer().remote_endpoint() << " CONNECTED" << endl; std::stringstream infoStream; infoStream << "Connected to " << m_sSLSocket.lowest_layer().remote_endpoint(); writeState(Tango::ON); INFO_STREAM << "SSLClient::handleHandShake() " << infoStream.str() << endl; std::stringstream statusStream; statusStream << "Connected to " << m_sSLSocket.lowest_layer().remote_endpoint(); writeStatus(statusStream.str()); writeStatus(infoStream.str()); startWriteRequest(); } else { ERROR_STREAM << "SSLClient::handleHandShake() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); } } Loading @@ -186,8 +191,11 @@ void SSLClient::startWriteRequest() boost::uint32_t bodySize = request_sp->ByteSize(); INFO_STREAM << m_sSLSocket.lowest_layer().remote_endpoint() << " <<<< " << bodySize << " BYTE" << endl; #ifdef VERBOSE_DEBUG INFO_STREAM << "SSLClient::startWriteRequest()" << m_sSLSocket.lowest_layer().remote_endpoint() << " <<<< " << bodySize << " byte" << endl; #endif std::vector<boost::uint8_t> writeBuff; writeBuff.resize(HEADER_SIZE + bodySize); Loading @@ -205,10 +213,16 @@ void SSLClient::startWriteRequest() catch(std::runtime_error& ec) { ERROR_STREAM << "SSLClient::startWriteRequest() " << ec.what() << endl; writeState(Tango::FAULT); writeStatus(ec.what()); } catch(...) { ERROR_STREAM << "SSLClient::startWriteRequest() unknown error" << endl; writeState(Tango::FAULT); writeStatus("Unknown error"); } } Loading @@ -235,8 +249,11 @@ void SSLClient::startReadResponseBody(boost::uint32_t bodySize) { DEBUG_STREAM << "SSLClient::startReadResponseBody()" << endl; INFO_STREAM << m_sSLSocket.lowest_layer().remote_endpoint() << " >>>> " << bodySize << " BYTE" << endl; #ifdef VERBOSE_DEBUG INFO_STREAM << "SSLClient::startReadResponseBody()" << m_sSLSocket.lowest_layer().remote_endpoint() << " >>>> " << bodySize << " byte" << endl; #endif m_readBuff.resize(HEADER_SIZE + bodySize); Loading Loading
src/Client.cpp +30 −7 Original line number Diff line number Diff line Loading @@ -163,7 +163,7 @@ void Client::run() DEBUG_STREAM << "Client::run() interrupt" << endl; break; } } //while } } //============================================================================== Loading @@ -173,13 +173,18 @@ void Client::startResolve() { DEBUG_STREAM << "Client::startResolve()" << endl; std::stringstream infoStream; infoStream << "Resolving host: " << m_configuration_sp->getRemoteHost() << " port: " << m_configuration_sp->getRemotePort(); INFO_STREAM << "Client::startResolve() " << infoStream.str() << endl; writeState(Tango::ON); writeStatus(infoStream.str()); boost::asio::ip::tcp::resolver::query query(m_configuration_sp->getRemoteHost(), boost::lexical_cast<std::string>(m_configuration_sp->getRemotePort())); INFO_STREAM << "Client::startResolve() host: " << m_configuration_sp->getRemoteHost() << " port: " << m_configuration_sp->getRemotePort() << endl; m_resetConnectionTimer.expires_from_now(boost::posix_time::seconds(30)); m_resolver.async_resolve(query, boost::bind(&Client::handleResolve, this, Loading @@ -203,6 +208,9 @@ void Client::handleResolve(const boost::system::error_code& errorCode, else { ERROR_STREAM << "Client::handleResolve() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); } } Loading @@ -220,6 +228,9 @@ void Client::handleWriteRequest(const boost::system::error_code& errorCode) else { ERROR_STREAM << "Client::handleRequest() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); } } Loading @@ -239,6 +250,9 @@ void Client::handleReadResponseHeader(const boost::system::error_code& errorCode else { ERROR_STREAM << "Client::handleReadResponseHeader() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); } } Loading Loading @@ -268,15 +282,24 @@ void Client::handleReadResponseBody(const boost::system::error_code& errorCode) catch(std::runtime_error& ec) { ERROR_STREAM << "Client::handleResponse() " << ec.what() << endl; writeState(Tango::FAULT); writeStatus(ec.what()); } catch(...) { ERROR_STREAM << "Client::handleResponse() unknown error" << endl; ERROR_STREAM << "Client::handleResponse() Unknown error" << endl; writeState(Tango::FAULT); writeStatus("Unknown error"); } } else { ERROR_STREAM << "Client::handleResponse() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); } } Loading @@ -290,7 +313,7 @@ void Client::resetConnection() if(m_resetConnectionTimer.expires_at() <= boost::asio::deadline_timer::traits_type::now()) { INFO_STREAM << "CONNECTION RESET AFTER TIMEOUT" << endl; ERROR_STREAM << "Client::resetConnection() Connection timeout" << endl; closeConnection(); Loading
src/PlainClient.cpp +31 −16 Original line number Diff line number Diff line Loading @@ -73,14 +73,12 @@ void PlainClient::startConnect(boost::asio::ip::tcp::resolver::iterator endPoint if(endPointIterator != boost::asio::ip::tcp::resolver::iterator()) { DEBUG_STREAM << "PlainClient::startConnect() connecting to " << endPointIterator->endpoint() << endl; std::stringstream infoStream; infoStream << "Connecting to " << endPointIterator->endpoint(); writeState(Tango::OFF); DEBUG_STREAM << "PlainClient::startConnect() " << infoStream.str() << endl; std::stringstream statusStream; statusStream << "Connecting to " << endPointIterator->endpoint(); writeStatus(statusStream.str()); writeStatus(infoStream.str()); m_plainSocket.async_connect(endPointIterator->endpoint(), boost::bind(&PlainClient::handleConnect, this, Loading @@ -89,6 +87,9 @@ void PlainClient::startConnect(boost::asio::ip::tcp::resolver::iterator endPoint else { ERROR_STREAM << "PlainClient::startConnect() no more endpoint" << endl; writeState(Tango::FAULT); writeStatus("No more endpoint"); } } Loading @@ -102,13 +103,12 @@ void PlainClient::handleConnect(const boost::system::error_code& errorCode, if(!errorCode) { INFO_STREAM << m_plainSocket.remote_endpoint() << " CONNECTED" << endl; std::stringstream infoStream; infoStream << "Connected to " << m_plainSocket.remote_endpoint(); writeState(Tango::ON); INFO_STREAM << "PlainClient::handleConnect() " << infoStream.str() << endl; std::stringstream statusStream; statusStream << "Connected to " << m_plainSocket.remote_endpoint(); writeStatus(statusStream.str()); writeStatus(infoStream.str()); startWriteRequest(); } Loading @@ -116,6 +116,9 @@ void PlainClient::handleConnect(const boost::system::error_code& errorCode, { ERROR_STREAM << "PlainClient::handleConnect() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); if(m_plainSocket.is_open()) m_plainSocket.close(); Loading @@ -136,8 +139,11 @@ void PlainClient::startWriteRequest() boost::uint32_t bodySize = request_sp->ByteSize(); INFO_STREAM << m_plainSocket.remote_endpoint() << " <<<< " << bodySize << " BYTE" << endl; #ifdef VERBOSE_DEBUG INFO_STREAM << "PlainClient::startRequest()" << m_plainSocket.remote_endpoint() << " <<<< " << bodySize << " byte" << endl; #endif std::vector<boost::uint8_t> writeBuff; writeBuff.resize(HEADER_SIZE + bodySize); Loading @@ -155,10 +161,16 @@ void PlainClient::startWriteRequest() catch(std::runtime_error& ec) { ERROR_STREAM << "PlainClient::startWriteRequest() " << ec.what() << endl; writeState(Tango::FAULT); writeStatus(ec.what()); } catch(...) { ERROR_STREAM << "PlainClient::startWriteRequest() unknown error" << endl; writeState(Tango::FAULT); writeStatus("Unknown error"); } } Loading @@ -185,8 +197,11 @@ void PlainClient::startReadResponseBody(boost::uint32_t bodySize) { DEBUG_STREAM << "PlainClient::startReadResponseBody()" << endl; INFO_STREAM << m_plainSocket.remote_endpoint() << " >>>> " << bodySize << " BYTE" << endl; #ifdef VERBOSE_DEBUG INFO_STREAM << "PlainClient::startReadResponseBody()" << m_plainSocket.remote_endpoint() << " >>>> " << bodySize << " byte" << endl; #endif m_readBuff.resize(HEADER_SIZE + bodySize); Loading
src/SSLClient.cpp +34 −17 Original line number Diff line number Diff line Loading @@ -91,14 +91,12 @@ void SSLClient::startConnect(boost::asio::ip::tcp::resolver::iterator endPointIt if(endPointIterator != boost::asio::ip::tcp::resolver::iterator()) { DEBUG_STREAM << "SSLClient::startConnect() connecting to " << endPointIterator->endpoint() << endl; std::stringstream infoStream; infoStream << "Connecting to " << endPointIterator->endpoint(); writeState(Tango::OFF); INFO_STREAM << "SSLClient::startConnect() " << infoStream.str() << endl; std::stringstream statusStream; statusStream << "Connecting to " << endPointIterator->endpoint(); writeStatus(statusStream.str()); writeStatus(infoStream.str()); m_sSLSocket.lowest_layer().async_connect(endPointIterator->endpoint(), boost::bind(&SSLClient::handleConnect, this, Loading @@ -106,7 +104,10 @@ void SSLClient::startConnect(boost::asio::ip::tcp::resolver::iterator endPointIt } else { ERROR_STREAM << "PlainClient::startConnect() no more endpoint" << endl; ERROR_STREAM << "PlainClient::startConnect() No more endpoint" << endl; writeState(Tango::FAULT); writeStatus("No more endpoint"); } } Loading @@ -126,6 +127,9 @@ void SSLClient::handleConnect(const boost::system::error_code& errorCode, { ERROR_STREAM << "PlainClient::handleConnect() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); if(m_sSLSocket.lowest_layer().is_open()) m_sSLSocket.lowest_layer().close(); Loading Loading @@ -156,20 +160,21 @@ void SSLClient::handleHandShake(const boost::system::error_code& errorCode) if(!errorCode) { INFO_STREAM << m_sSLSocket.lowest_layer().remote_endpoint() << " CONNECTED" << endl; std::stringstream infoStream; infoStream << "Connected to " << m_sSLSocket.lowest_layer().remote_endpoint(); writeState(Tango::ON); INFO_STREAM << "SSLClient::handleHandShake() " << infoStream.str() << endl; std::stringstream statusStream; statusStream << "Connected to " << m_sSLSocket.lowest_layer().remote_endpoint(); writeStatus(statusStream.str()); writeStatus(infoStream.str()); startWriteRequest(); } else { ERROR_STREAM << "SSLClient::handleHandShake() " << errorCode.message() << endl; writeState(Tango::FAULT); writeStatus(errorCode.message()); } } Loading @@ -186,8 +191,11 @@ void SSLClient::startWriteRequest() boost::uint32_t bodySize = request_sp->ByteSize(); INFO_STREAM << m_sSLSocket.lowest_layer().remote_endpoint() << " <<<< " << bodySize << " BYTE" << endl; #ifdef VERBOSE_DEBUG INFO_STREAM << "SSLClient::startWriteRequest()" << m_sSLSocket.lowest_layer().remote_endpoint() << " <<<< " << bodySize << " byte" << endl; #endif std::vector<boost::uint8_t> writeBuff; writeBuff.resize(HEADER_SIZE + bodySize); Loading @@ -205,10 +213,16 @@ void SSLClient::startWriteRequest() catch(std::runtime_error& ec) { ERROR_STREAM << "SSLClient::startWriteRequest() " << ec.what() << endl; writeState(Tango::FAULT); writeStatus(ec.what()); } catch(...) { ERROR_STREAM << "SSLClient::startWriteRequest() unknown error" << endl; writeState(Tango::FAULT); writeStatus("Unknown error"); } } Loading @@ -235,8 +249,11 @@ void SSLClient::startReadResponseBody(boost::uint32_t bodySize) { DEBUG_STREAM << "SSLClient::startReadResponseBody()" << endl; INFO_STREAM << m_sSLSocket.lowest_layer().remote_endpoint() << " >>>> " << bodySize << " BYTE" << endl; #ifdef VERBOSE_DEBUG INFO_STREAM << "SSLClient::startReadResponseBody()" << m_sSLSocket.lowest_layer().remote_endpoint() << " >>>> " << bodySize << " byte" << endl; #endif m_readBuff.resize(HEADER_SIZE + bodySize); Loading