Loading src/DBManager.cpp +12 −15 Original line number Diff line number Diff line Loading @@ -16,10 +16,6 @@ DBManager::DBManager(Tango::DeviceImpl* deviceImpl_p, m_configuration_sp(configuration_sp) { DEBUG_STREAM << "DBManager::DBManager()" << endl; unsigned int connectionNumber = m_configuration_sp->getDatabaseConnectionNumber(); m_connectionPool_sp.reset(new soci::connection_pool(connectionNumber)); } //============================================================================== Loading Loading @@ -51,6 +47,10 @@ void DBManager::connect() throw(soci::soci_error) boost::mutex::scoped_lock lock(m_connectionPoolMutex); unsigned int connectionNumber = m_configuration_sp->getDatabaseConnectionNumber(); m_connectionPool_sp.reset(new soci::connection_pool(connectionNumber)); std::stringstream connection; connection << " host=" << m_configuration_sp->getDatabaseHost(); connection << " port=" << m_configuration_sp->getDatabasePort(); Loading @@ -61,13 +61,9 @@ void DBManager::connect() throw(soci::soci_error) INFO_STREAM << "DBManager::connect(): " << connection.str() << endl; #endif unsigned int connectionNumber = m_configuration_sp->getDatabaseConnectionNumber(); for(unsigned int i=0; i<connectionNumber; ++i) { m_connectionPool_sp->at(i).open(soci::mysql, connection.str()); } } //============================================================================== // DBManager::disconnect() Loading @@ -78,12 +74,7 @@ void DBManager::disconnect() boost::mutex::scoped_lock lock(m_connectionPoolMutex); unsigned int connectionNumber = m_configuration_sp->getDatabaseConnectionNumber(); for(unsigned int i=0; i<connectionNumber; ++i) { m_connectionPool_sp->at(i).close(); } m_connectionPool_sp.reset(); } //============================================================================== Loading @@ -94,6 +85,9 @@ DBManager::InformationList DBManager::retrieveInformation(std::string schema, { DEBUG_STREAM << "DBManager::retrieveInformation()" << endl; if(!m_connectionPool_sp) throw soci::soci_error("Connection pool not initialized"); soci::session session(*m_connectionPool_sp); if(session.get_backend() == NULL) Loading @@ -119,6 +113,9 @@ DBManager::RowsetSP DBManager::retrieveNewTuples(std::string schema, { DEBUG_STREAM << "DBManager::retrieveNewTuples()" << endl; if(!m_connectionPool_sp) throw soci::soci_error("Connection pool not initialized"); soci::session session(*m_connectionPool_sp); if(session.get_backend() == NULL) Loading src/PlainSession.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -145,7 +145,7 @@ void PlainSession::startWriteResponse() m_strand.wrap(boost::bind(&PlainSession::handleWriteResponse, shared_from_this(), boost::asio::placeholders::error))); } catch(std::runtime_error& ec) catch(std::exception& ec) { ERROR_STREAM << "SSLSession::startWriteResponse() " << ec.what() << " from " << m_remoteEndpoint << endl; Loading src/PlainSession.h +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ public: protected: //------------------------------------------------------------------------------ // [Protected] Utilities methods // [Protected] Request response methods //------------------------------------------------------------------------------ virtual void startReadRequestHeader(); Loading src/ProtocolManager.cpp +16 −16 Original line number Diff line number Diff line Loading @@ -100,13 +100,13 @@ ResponseSP ProtocolManager::prepareAuthroisation(RequestSP request_sp) response_sp->set_type(Response::AUTHORIZATION); Response::Authorization* auth_resp = response_sp->mutable_authorization(); Response::Authorization* authResp = response_sp->mutable_authorization(); if(!m_isAuthorised) { const Request::Authorization& auth_req = request_sp->authorization(); std::string username = auth_req.username(); std::string password = auth_req.password(); const Request::Authorization& authReq = request_sp->authorization(); std::string username = authReq.username(); std::string password = authReq.password(); if(m_configuration_sp->isUserAuthorized(username, password)) { Loading @@ -115,8 +115,8 @@ ResponseSP ProtocolManager::prepareAuthroisation(RequestSP request_sp) m_isAuthorised = true; auth_resp->set_state(Response::Authorization::ACCEPTED); auth_resp->set_status("Authorization accepted"); authResp->set_state(Response::Authorization::ACCEPTED); authResp->set_status("Authorization accepted"); } else { Loading @@ -125,8 +125,8 @@ ResponseSP ProtocolManager::prepareAuthroisation(RequestSP request_sp) m_isAuthorised = false; auth_resp->set_state(Response::Authorization::REJECTED); auth_resp->set_status("Invalid username or password"); authResp->set_state(Response::Authorization::REJECTED); authResp->set_status("Invalid username or password"); } } else Loading @@ -134,8 +134,8 @@ ResponseSP ProtocolManager::prepareAuthroisation(RequestSP request_sp) WARN_STREAM << "ProtocolManager::prepareAuthroisation() " << "Already authorized from " << m_remoteEndpoint << endl; auth_resp->set_state(Response::Authorization::REJECTED); auth_resp->set_status("Already authorized"); authResp->set_state(Response::Authorization::REJECTED); authResp->set_status("Already authorized"); } return response_sp; Loading Loading @@ -173,7 +173,7 @@ ResponseSP ProtocolManager::prepareValidation(RequestSP request_sp) std::stringstream errorStream; errorStream << "Table " << m_validatedSchema << "." << m_validatedTable << " not exists"; throw soci::soci_error(errorStream.str()); throw std::runtime_error(errorStream.str()); } if(validationReq.columns_size() != (int)informationList.size()) Loading @@ -181,7 +181,7 @@ ResponseSP ProtocolManager::prepareValidation(RequestSP request_sp) std::stringstream errorStream; errorStream << "Table " << m_validatedSchema << "." << m_validatedTable << " has different columns size"; throw soci::soci_error(errorStream.str()); throw std::runtime_error(errorStream.str()); } for(int i=0; i<validationReq.columns_size(); ++i) Loading Loading @@ -357,10 +357,10 @@ void ProtocolManager::validateColumn(const Request::Validation::Column& column, } #ifdef VERBOSE_DEBUG INFO_STREAM << "ProtocolManager::validateColumn(): " << columnName << " " << columnType << " " << isNullable << endl; INFO_STREAM << "ProtocolManager::validateColumn(): " << column.name() << " " << column.type() << " " << column.nullable() << endl; INFO_STREAM << "ProtocolManager::validateColumn() " << column.name() << "<->" << columnName << " " << column.type() << "<->" << columnType << " " << column.nullable() << "<->" << isNullable << endl; #endif } } Loading src/SSLSession.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -181,7 +181,7 @@ void SSLSession::startWriteResponse() m_strand.wrap(boost::bind(&SSLSession::handleWriteResponse, shared_from_this(), boost::asio::placeholders::error))); } catch(std::runtime_error& ec) catch(std::exception& ec) { ERROR_STREAM << "SSLSession::startWriteResponse() " << ec.what() << " from " << m_remoteEndpoint << endl; Loading Loading
src/DBManager.cpp +12 −15 Original line number Diff line number Diff line Loading @@ -16,10 +16,6 @@ DBManager::DBManager(Tango::DeviceImpl* deviceImpl_p, m_configuration_sp(configuration_sp) { DEBUG_STREAM << "DBManager::DBManager()" << endl; unsigned int connectionNumber = m_configuration_sp->getDatabaseConnectionNumber(); m_connectionPool_sp.reset(new soci::connection_pool(connectionNumber)); } //============================================================================== Loading Loading @@ -51,6 +47,10 @@ void DBManager::connect() throw(soci::soci_error) boost::mutex::scoped_lock lock(m_connectionPoolMutex); unsigned int connectionNumber = m_configuration_sp->getDatabaseConnectionNumber(); m_connectionPool_sp.reset(new soci::connection_pool(connectionNumber)); std::stringstream connection; connection << " host=" << m_configuration_sp->getDatabaseHost(); connection << " port=" << m_configuration_sp->getDatabasePort(); Loading @@ -61,13 +61,9 @@ void DBManager::connect() throw(soci::soci_error) INFO_STREAM << "DBManager::connect(): " << connection.str() << endl; #endif unsigned int connectionNumber = m_configuration_sp->getDatabaseConnectionNumber(); for(unsigned int i=0; i<connectionNumber; ++i) { m_connectionPool_sp->at(i).open(soci::mysql, connection.str()); } } //============================================================================== // DBManager::disconnect() Loading @@ -78,12 +74,7 @@ void DBManager::disconnect() boost::mutex::scoped_lock lock(m_connectionPoolMutex); unsigned int connectionNumber = m_configuration_sp->getDatabaseConnectionNumber(); for(unsigned int i=0; i<connectionNumber; ++i) { m_connectionPool_sp->at(i).close(); } m_connectionPool_sp.reset(); } //============================================================================== Loading @@ -94,6 +85,9 @@ DBManager::InformationList DBManager::retrieveInformation(std::string schema, { DEBUG_STREAM << "DBManager::retrieveInformation()" << endl; if(!m_connectionPool_sp) throw soci::soci_error("Connection pool not initialized"); soci::session session(*m_connectionPool_sp); if(session.get_backend() == NULL) Loading @@ -119,6 +113,9 @@ DBManager::RowsetSP DBManager::retrieveNewTuples(std::string schema, { DEBUG_STREAM << "DBManager::retrieveNewTuples()" << endl; if(!m_connectionPool_sp) throw soci::soci_error("Connection pool not initialized"); soci::session session(*m_connectionPool_sp); if(session.get_backend() == NULL) Loading
src/PlainSession.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -145,7 +145,7 @@ void PlainSession::startWriteResponse() m_strand.wrap(boost::bind(&PlainSession::handleWriteResponse, shared_from_this(), boost::asio::placeholders::error))); } catch(std::runtime_error& ec) catch(std::exception& ec) { ERROR_STREAM << "SSLSession::startWriteResponse() " << ec.what() << " from " << m_remoteEndpoint << endl; Loading
src/PlainSession.h +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ public: protected: //------------------------------------------------------------------------------ // [Protected] Utilities methods // [Protected] Request response methods //------------------------------------------------------------------------------ virtual void startReadRequestHeader(); Loading
src/ProtocolManager.cpp +16 −16 Original line number Diff line number Diff line Loading @@ -100,13 +100,13 @@ ResponseSP ProtocolManager::prepareAuthroisation(RequestSP request_sp) response_sp->set_type(Response::AUTHORIZATION); Response::Authorization* auth_resp = response_sp->mutable_authorization(); Response::Authorization* authResp = response_sp->mutable_authorization(); if(!m_isAuthorised) { const Request::Authorization& auth_req = request_sp->authorization(); std::string username = auth_req.username(); std::string password = auth_req.password(); const Request::Authorization& authReq = request_sp->authorization(); std::string username = authReq.username(); std::string password = authReq.password(); if(m_configuration_sp->isUserAuthorized(username, password)) { Loading @@ -115,8 +115,8 @@ ResponseSP ProtocolManager::prepareAuthroisation(RequestSP request_sp) m_isAuthorised = true; auth_resp->set_state(Response::Authorization::ACCEPTED); auth_resp->set_status("Authorization accepted"); authResp->set_state(Response::Authorization::ACCEPTED); authResp->set_status("Authorization accepted"); } else { Loading @@ -125,8 +125,8 @@ ResponseSP ProtocolManager::prepareAuthroisation(RequestSP request_sp) m_isAuthorised = false; auth_resp->set_state(Response::Authorization::REJECTED); auth_resp->set_status("Invalid username or password"); authResp->set_state(Response::Authorization::REJECTED); authResp->set_status("Invalid username or password"); } } else Loading @@ -134,8 +134,8 @@ ResponseSP ProtocolManager::prepareAuthroisation(RequestSP request_sp) WARN_STREAM << "ProtocolManager::prepareAuthroisation() " << "Already authorized from " << m_remoteEndpoint << endl; auth_resp->set_state(Response::Authorization::REJECTED); auth_resp->set_status("Already authorized"); authResp->set_state(Response::Authorization::REJECTED); authResp->set_status("Already authorized"); } return response_sp; Loading Loading @@ -173,7 +173,7 @@ ResponseSP ProtocolManager::prepareValidation(RequestSP request_sp) std::stringstream errorStream; errorStream << "Table " << m_validatedSchema << "." << m_validatedTable << " not exists"; throw soci::soci_error(errorStream.str()); throw std::runtime_error(errorStream.str()); } if(validationReq.columns_size() != (int)informationList.size()) Loading @@ -181,7 +181,7 @@ ResponseSP ProtocolManager::prepareValidation(RequestSP request_sp) std::stringstream errorStream; errorStream << "Table " << m_validatedSchema << "." << m_validatedTable << " has different columns size"; throw soci::soci_error(errorStream.str()); throw std::runtime_error(errorStream.str()); } for(int i=0; i<validationReq.columns_size(); ++i) Loading Loading @@ -357,10 +357,10 @@ void ProtocolManager::validateColumn(const Request::Validation::Column& column, } #ifdef VERBOSE_DEBUG INFO_STREAM << "ProtocolManager::validateColumn(): " << columnName << " " << columnType << " " << isNullable << endl; INFO_STREAM << "ProtocolManager::validateColumn(): " << column.name() << " " << column.type() << " " << column.nullable() << endl; INFO_STREAM << "ProtocolManager::validateColumn() " << column.name() << "<->" << columnName << " " << column.type() << "<->" << columnType << " " << column.nullable() << "<->" << isNullable << endl; #endif } } Loading
src/SSLSession.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -181,7 +181,7 @@ void SSLSession::startWriteResponse() m_strand.wrap(boost::bind(&SSLSession::handleWriteResponse, shared_from_this(), boost::asio::placeholders::error))); } catch(std::runtime_error& ec) catch(std::exception& ec) { ERROR_STREAM << "SSLSession::startWriteResponse() " << ec.what() << " from " << m_remoteEndpoint << endl; Loading