Commit 02ec78a7 authored by Marco De Marco's avatar Marco De Marco
Browse files

Communication works without error messages

parent 27a22134
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@

#include <boost/lexical_cast.hpp>
#include <boost/bind.hpp>
#include <stdexcept>

namespace MetadataImporter_ns
{
@@ -37,9 +36,11 @@ Client::~Client()

    m_ioService.stop();

    m_work_sp.reset();

    if(m_thread_sp)
    {
        m_thread_sp->interrupt();
        //m_thread_sp->interrupt();

        m_thread_sp->join();
    }
@@ -76,7 +77,7 @@ void Client::stop()

    if(m_thread_sp)
    {
        m_thread_sp->interrupt();
        //m_thread_sp->interrupt();

        m_thread_sp->join();
    }
+3 −0
Original line number Diff line number Diff line
@@ -168,6 +168,9 @@ protected:

    //Tango status property
    std::string m_status;

    //Address and port of remote endpoint
    std::string remoteEndpoint;
};

}   //End of namespace
+7 −1
Original line number Diff line number Diff line
@@ -56,7 +56,6 @@ void DBManager::connect() throw(soci::soci_error)

#ifdef VERBOSE_DEBUG
    INFO_STREAM << "CONNECTION: " << connection.str() << endl;
    INFO_STREAM << "-------------------------------------------------" << endl;
#endif

    m_session_sp->open(soci::mysql, connection.str());
@@ -96,6 +95,13 @@ DBManager::InformationList DBManager::retrieveInformation(std::string schema,

    std::copy(rows.begin(), rows.end(), std::back_inserter(informationList));

    if(informationList.empty())
    {
        std::stringstream errorStream;
        errorStream << schema << "." << table << " not exists";
        throw soci::soci_error(errorStream.str());
    }

    return informationList;
}

+16 −10
Original line number Diff line number Diff line
#include <PlainClient.h>

#include <boost/lexical_cast.hpp>
#include <boost/bind.hpp>
#include <sstream>

namespace MetadataImporter_ns
{
@@ -103,10 +103,13 @@ void PlainClient::handleConnect(const boost::system::error_code& errorCode,

    if(!errorCode)
    {
        remoteEndpoint = boost::lexical_cast<std::string>(
            m_plainSocket.remote_endpoint());

        std::stringstream infoStream;
        infoStream << "Connected to " << m_plainSocket.remote_endpoint();
        infoStream << "Connected to " << remoteEndpoint;

        INFO_STREAM << "PlainClient::handleConnect() " << infoStream.str() << endl;
        INFO_STREAM << "PlainClient::handleConnect() " << remoteEndpoint << endl;

        writeStatus(infoStream.str());

@@ -141,8 +144,7 @@ void PlainClient::startWriteRequest()

        #ifdef VERBOSE_DEBUG
            INFO_STREAM << "PlainClient::startRequest() "
                << m_plainSocket.remote_endpoint()
                << " <<<< " << bodySize << " byte" << endl;
                << remoteEndpoint << " <<<< " << bodySize << " byte" << endl;
        #endif

        std::vector<boost::uint8_t> writeBuff;
@@ -199,8 +201,7 @@ void PlainClient::startReadResponseBody(boost::uint32_t bodySize)

    #ifdef VERBOSE_DEBUG
        INFO_STREAM << "PlainClient::startReadResponseBody() "
            << m_plainSocket.remote_endpoint()
            << " >>>> " << bodySize << " byte" << endl;
            << remoteEndpoint << " >>>> " << bodySize << " byte" << endl;
    #endif

    m_readBuff.resize(HEADER_SIZE + bodySize);
@@ -220,8 +221,13 @@ void PlainClient::closeConnection()
{
    DEBUG_STREAM << "PlainClient::closeConnection()" << endl;

    std::stringstream infoStream;
    infoStream << "Disconnected from " << remoteEndpoint;

    INFO_STREAM << "PlainClient::closeConnection() " << infoStream.str() << endl;

    writeState(Tango::OFF);
    writeStatus("Disconnected");
    writeStatus(infoStream.str());

    boost::system::error_code errorCode;

+16 −9
Original line number Diff line number Diff line
#include <SSLClient.h>

#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/bind.hpp>

namespace MetadataImporter_ns
{
@@ -160,8 +161,11 @@ void SSLClient::handleHandShake(const boost::system::error_code& errorCode)

    if(!errorCode)
    {
        remoteEndpoint = boost::lexical_cast<std::string>(
            m_sSLSocket.lowest_layer().remote_endpoint());

        std::stringstream infoStream;
        infoStream << "Connected to " << m_sSLSocket.lowest_layer().remote_endpoint();
        infoStream << "Connected to " << remoteEndpoint;

        INFO_STREAM << "SSLClient::handleHandShake() " << infoStream.str() << endl;

@@ -193,8 +197,7 @@ void SSLClient::startWriteRequest()

        #ifdef VERBOSE_DEBUG
            INFO_STREAM << "SSLClient::startWriteRequest() "
                << m_sSLSocket.lowest_layer().remote_endpoint()
                << " <<<< " << bodySize << " byte" << endl;
                << remoteEndpoint << " <<<< " << bodySize << " byte" << endl;
        #endif

        std::vector<boost::uint8_t> writeBuff;
@@ -251,8 +254,7 @@ void SSLClient::startReadResponseBody(boost::uint32_t bodySize)

    #ifdef VERBOSE_DEBUG
        INFO_STREAM << "SSLClient::startReadResponseBody() "
            << m_sSLSocket.lowest_layer().remote_endpoint()
            << " >>>> " << bodySize << " byte" << endl;
            << remoteEndpoint << " >>>> " << bodySize << " byte" << endl;
    #endif

    m_readBuff.resize(HEADER_SIZE + bodySize);
@@ -272,8 +274,13 @@ void SSLClient::closeConnection()
{
    DEBUG_STREAM << "SSLClient::closeConnection()" << endl;

    std::stringstream infoStream;
    infoStream << "Disconnected from " << remoteEndpoint;

    INFO_STREAM << "SSLClient::closeConnection() " << infoStream.str() << endl;

    writeState(Tango::OFF);
    writeStatus("Disconnected");
    writeStatus(infoStream.str());

    boost::system::error_code errorCode;