示例#1
0
DBSyncConnection::DBSyncConnection( Servent* s, const source_ptr& src )
    : Connection( s )
    , m_source( src )
    , m_state( UNKNOWN )
{
    qDebug() << Q_FUNC_INFO << src->id() << thread();

    connect( this,            SIGNAL( stateChanged( DBSyncConnection::State, DBSyncConnection::State, QString ) ),
             m_source.data(),   SLOT( onStateChanged( DBSyncConnection::State, DBSyncConnection::State, QString ) ) );
    connect( m_source.data(), SIGNAL( commandsFinished() ),
             this,              SLOT( lastOpApplied() ) );

    this->setMsgProcessorModeIn( MsgProcessor::PARSE_JSON | MsgProcessor::UNCOMPRESS_ALL );

    // msgs are stored compressed in the db, so not typically needed here, but doesnt hurt:
    this->setMsgProcessorModeOut( MsgProcessor::COMPRESS_IF_LARGE );
}
示例#2
0
DBSyncConnection::DBSyncConnection( Servent* s, source_ptr src )
    : Connection( s )
    , m_source( src )
    , m_state( UNKNOWN )
{
    qDebug() << Q_FUNC_INFO << src->id() << thread();
    connect( this,            SIGNAL( stateChanged( DBSyncConnection::State, DBSyncConnection::State, QString ) ),
             m_source.data(),   SLOT( onStateChanged( DBSyncConnection::State, DBSyncConnection::State, QString ) ) );

    m_timer.setInterval( IDLE_TIMEOUT );
    connect( &m_timer, SIGNAL( timeout() ), SLOT( idleTimeout() ) );

    this->setMsgProcessorModeIn( MsgProcessor::PARSE_JSON | MsgProcessor::UNCOMPRESS_ALL );

    // msgs are stored compressed in the db, so not typically needed here, but doesnt hurt:
    this->setMsgProcessorModeOut( MsgProcessor::COMPRESS_IF_LARGE );
}