1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-08 10:02:29 +02:00

Move outbound, ready, onceonly into ConnectionPrivate

This commit is contained in:
Uwe L. Korn 2013-06-16 10:52:16 +02:00
parent 16d2f33adc
commit fbe434a4d5
4 changed files with 29 additions and 15 deletions

View File

@ -35,8 +35,6 @@ Connection::Connection( Servent* parent )
: QObject()
, m_sock( 0 )
, m_servent( parent )
, m_ready( false )
, m_onceonly( true )
, d_ptr( new ConnectionPrivate( this ) )
{
moveToThread( m_servent->thread() );
@ -120,15 +118,19 @@ Connection::socket()
}
void
Connection::setOutbound(bool o)
Connection::setOutbound( bool o )
{
m_outbound = o;
Q_D( Connection );
d->outbound = o;
}
bool
Connection::outbound() const
{
return m_outbound;
Q_D( const Connection );
return d->outbound;
}
Servent*
@ -229,19 +231,25 @@ Connection::name() const
void
Connection::setOnceOnly( bool b )
{
m_onceonly = b;
Q_D( Connection );
d->onceonly = b;
}
bool
Connection::onceOnly() const
{
return m_onceonly;
Q_D( const Connection );
return d->onceonly;
}
bool
Connection::isReady() const
{
return m_ready;
Q_D( const Connection );
return d->ready;
}
bool
@ -359,7 +367,9 @@ Connection::checkACLResult( const QString &nodeid, const QString &username, Toma
void
Connection::authCheckTimeout()
{
if ( m_ready )
Q_D( Connection );
if ( d->ready )
return;
tDebug( LOGVERBOSE ) << "Closing connection, not authed in time.";
@ -549,19 +559,19 @@ Connection::handleReadMsg()
d->msg->is( Msg::SETUP ) &&
d->msg->payload() == "ok" )
{
m_ready = true;
d->ready = true;
tDebug( LOGVERBOSE ) << "Connection" << id() << "READY";
setup();
emit ready();
}
else if ( !m_ready &&
else if ( !d->ready &&
outbound() &&
d->msg->is( Msg::SETUP ) )
{
if ( d->msg->payload() == PROTOVER )
{
sendMsg( Msg::factory( "ok", Msg::SETUP ) );
m_ready = true;
d->ready = true;
tDebug( LOGVERBOSE ) << "Connection" << id() << "READY";
setup();
emit ready();

View File

@ -123,7 +123,6 @@ private slots:
protected:
QPointer<QTcpSocket> m_sock;
Servent* m_servent;
bool m_outbound, m_ready, m_onceonly;
private:
Q_DECLARE_PRIVATE( Connection )

View File

@ -36,11 +36,13 @@ public:
, do_shutdown( false )
, actually_shutting_down( false )
, peer_disconnected( false )
, peerport( 0 )
, ready( false )
, onceonly( true )
, tx_bytes( 0 )
, tx_bytes_requested( 0 )
, rx_bytes( 0 )
, id( "Connection()" )
, peerport( 0 )
, statstimer( 0 )
, stats_tx_bytes_per_sec( 0 )
, stats_rx_bytes_per_sec( 0 )
@ -56,6 +58,9 @@ private:
bool do_shutdown;
bool actually_shutting_down;
bool peer_disconnected;
bool outbound;
bool ready;
bool onceonly;
qint64 tx_bytes;
qint64 tx_bytes_requested;
qint64 rx_bytes;

View File

@ -277,7 +277,7 @@ ControlConnection::handleMsg( msg_ptr msg )
void
ControlConnection::authCheckTimeout()
{
if ( m_ready )
if ( isReady() )
return;
Servent::instance()->queueForAclResult( bareName(), m_peerInfos );