mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Move outbound, ready, onceonly into ConnectionPrivate
This commit is contained in:
@@ -35,8 +35,6 @@ Connection::Connection( Servent* parent )
|
|||||||
: QObject()
|
: QObject()
|
||||||
, m_sock( 0 )
|
, m_sock( 0 )
|
||||||
, m_servent( parent )
|
, m_servent( parent )
|
||||||
, m_ready( false )
|
|
||||||
, m_onceonly( true )
|
|
||||||
, d_ptr( new ConnectionPrivate( this ) )
|
, d_ptr( new ConnectionPrivate( this ) )
|
||||||
{
|
{
|
||||||
moveToThread( m_servent->thread() );
|
moveToThread( m_servent->thread() );
|
||||||
@@ -120,15 +118,19 @@ Connection::socket()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Connection::setOutbound(bool o)
|
Connection::setOutbound( bool o )
|
||||||
{
|
{
|
||||||
m_outbound = o;
|
Q_D( Connection );
|
||||||
|
|
||||||
|
d->outbound = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Connection::outbound() const
|
Connection::outbound() const
|
||||||
{
|
{
|
||||||
return m_outbound;
|
Q_D( const Connection );
|
||||||
|
|
||||||
|
return d->outbound;
|
||||||
}
|
}
|
||||||
|
|
||||||
Servent*
|
Servent*
|
||||||
@@ -229,19 +231,25 @@ Connection::name() const
|
|||||||
void
|
void
|
||||||
Connection::setOnceOnly( bool b )
|
Connection::setOnceOnly( bool b )
|
||||||
{
|
{
|
||||||
m_onceonly = b;
|
Q_D( Connection );
|
||||||
|
|
||||||
|
d->onceonly = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Connection::onceOnly() const
|
Connection::onceOnly() const
|
||||||
{
|
{
|
||||||
return m_onceonly;
|
Q_D( const Connection );
|
||||||
|
|
||||||
|
return d->onceonly;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Connection::isReady() const
|
Connection::isReady() const
|
||||||
{
|
{
|
||||||
return m_ready;
|
Q_D( const Connection );
|
||||||
|
|
||||||
|
return d->ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -359,7 +367,9 @@ Connection::checkACLResult( const QString &nodeid, const QString &username, Toma
|
|||||||
void
|
void
|
||||||
Connection::authCheckTimeout()
|
Connection::authCheckTimeout()
|
||||||
{
|
{
|
||||||
if ( m_ready )
|
Q_D( Connection );
|
||||||
|
|
||||||
|
if ( d->ready )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tDebug( LOGVERBOSE ) << "Closing connection, not authed in time.";
|
tDebug( LOGVERBOSE ) << "Closing connection, not authed in time.";
|
||||||
@@ -549,19 +559,19 @@ Connection::handleReadMsg()
|
|||||||
d->msg->is( Msg::SETUP ) &&
|
d->msg->is( Msg::SETUP ) &&
|
||||||
d->msg->payload() == "ok" )
|
d->msg->payload() == "ok" )
|
||||||
{
|
{
|
||||||
m_ready = true;
|
d->ready = true;
|
||||||
tDebug( LOGVERBOSE ) << "Connection" << id() << "READY";
|
tDebug( LOGVERBOSE ) << "Connection" << id() << "READY";
|
||||||
setup();
|
setup();
|
||||||
emit ready();
|
emit ready();
|
||||||
}
|
}
|
||||||
else if ( !m_ready &&
|
else if ( !d->ready &&
|
||||||
outbound() &&
|
outbound() &&
|
||||||
d->msg->is( Msg::SETUP ) )
|
d->msg->is( Msg::SETUP ) )
|
||||||
{
|
{
|
||||||
if ( d->msg->payload() == PROTOVER )
|
if ( d->msg->payload() == PROTOVER )
|
||||||
{
|
{
|
||||||
sendMsg( Msg::factory( "ok", Msg::SETUP ) );
|
sendMsg( Msg::factory( "ok", Msg::SETUP ) );
|
||||||
m_ready = true;
|
d->ready = true;
|
||||||
tDebug( LOGVERBOSE ) << "Connection" << id() << "READY";
|
tDebug( LOGVERBOSE ) << "Connection" << id() << "READY";
|
||||||
setup();
|
setup();
|
||||||
emit ready();
|
emit ready();
|
||||||
|
@@ -123,7 +123,6 @@ private slots:
|
|||||||
protected:
|
protected:
|
||||||
QPointer<QTcpSocket> m_sock;
|
QPointer<QTcpSocket> m_sock;
|
||||||
Servent* m_servent;
|
Servent* m_servent;
|
||||||
bool m_outbound, m_ready, m_onceonly;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DECLARE_PRIVATE( Connection )
|
Q_DECLARE_PRIVATE( Connection )
|
||||||
|
@@ -36,11 +36,13 @@ public:
|
|||||||
, do_shutdown( false )
|
, do_shutdown( false )
|
||||||
, actually_shutting_down( false )
|
, actually_shutting_down( false )
|
||||||
, peer_disconnected( false )
|
, peer_disconnected( false )
|
||||||
, peerport( 0 )
|
, ready( false )
|
||||||
|
, onceonly( true )
|
||||||
, tx_bytes( 0 )
|
, tx_bytes( 0 )
|
||||||
, tx_bytes_requested( 0 )
|
, tx_bytes_requested( 0 )
|
||||||
, rx_bytes( 0 )
|
, rx_bytes( 0 )
|
||||||
, id( "Connection()" )
|
, id( "Connection()" )
|
||||||
|
, peerport( 0 )
|
||||||
, statstimer( 0 )
|
, statstimer( 0 )
|
||||||
, stats_tx_bytes_per_sec( 0 )
|
, stats_tx_bytes_per_sec( 0 )
|
||||||
, stats_rx_bytes_per_sec( 0 )
|
, stats_rx_bytes_per_sec( 0 )
|
||||||
@@ -56,6 +58,9 @@ private:
|
|||||||
bool do_shutdown;
|
bool do_shutdown;
|
||||||
bool actually_shutting_down;
|
bool actually_shutting_down;
|
||||||
bool peer_disconnected;
|
bool peer_disconnected;
|
||||||
|
bool outbound;
|
||||||
|
bool ready;
|
||||||
|
bool onceonly;
|
||||||
qint64 tx_bytes;
|
qint64 tx_bytes;
|
||||||
qint64 tx_bytes_requested;
|
qint64 tx_bytes_requested;
|
||||||
qint64 rx_bytes;
|
qint64 rx_bytes;
|
||||||
|
@@ -277,7 +277,7 @@ ControlConnection::handleMsg( msg_ptr msg )
|
|||||||
void
|
void
|
||||||
ControlConnection::authCheckTimeout()
|
ControlConnection::authCheckTimeout()
|
||||||
{
|
{
|
||||||
if ( m_ready )
|
if ( isReady() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Servent::instance()->queueForAclResult( bareName(), m_peerInfos );
|
Servent::instance()->queueForAclResult( bareName(), m_peerInfos );
|
||||||
|
Reference in New Issue
Block a user