mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
* Style fixes to ConnectionManager.
This commit is contained in:
@@ -42,6 +42,7 @@ static QMutex nodeMapMutex;
|
|||||||
static Tomahawk::Utils::WeakObjectHash< ConnectionManager > connectionManagers;
|
static Tomahawk::Utils::WeakObjectHash< ConnectionManager > connectionManagers;
|
||||||
static QHash< QString, QSharedPointer< ConnectionManager > > activeConnectionManagers;
|
static QHash< QString, QSharedPointer< ConnectionManager > > activeConnectionManagers;
|
||||||
|
|
||||||
|
|
||||||
QSharedPointer<ConnectionManager>
|
QSharedPointer<ConnectionManager>
|
||||||
ConnectionManager::getManagerForNodeId( const QString &nodeid )
|
ConnectionManager::getManagerForNodeId( const QString &nodeid )
|
||||||
{
|
{
|
||||||
@@ -57,6 +58,7 @@ ConnectionManager::getManagerForNodeId( const QString &nodeid )
|
|||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ConnectionManager::setActive( bool active, const QString& nodeid, const QSharedPointer<ConnectionManager>& manager )
|
ConnectionManager::setActive( bool active, const QString& nodeid, const QSharedPointer<ConnectionManager>& manager )
|
||||||
{
|
{
|
||||||
@@ -71,6 +73,7 @@ ConnectionManager::setActive( bool active, const QString& nodeid, const QSharedP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ConnectionManager Implementation */
|
/* ConnectionManager Implementation */
|
||||||
|
|
||||||
ConnectionManager::ConnectionManager( const QString &nodeid )
|
ConnectionManager::ConnectionManager( const QString &nodeid )
|
||||||
@@ -79,11 +82,13 @@ ConnectionManager::ConnectionManager( const QString &nodeid )
|
|||||||
// TODO sth?
|
// TODO sth?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ConnectionManager::~ConnectionManager()
|
ConnectionManager::~ConnectionManager()
|
||||||
{
|
{
|
||||||
delete d_ptr;
|
delete d_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ConnectionManager::handleSipInfo( const Tomahawk::peerinfo_ptr &peerInfo )
|
ConnectionManager::handleSipInfo( const Tomahawk::peerinfo_ptr &peerInfo )
|
||||||
{
|
{
|
||||||
@@ -91,12 +96,14 @@ ConnectionManager::handleSipInfo( const Tomahawk::peerinfo_ptr &peerInfo )
|
|||||||
QtConcurrent::run( &ConnectionManager::handleSipInfoPrivateS, peerInfo, weakRef().toStrongRef() );
|
QtConcurrent::run( &ConnectionManager::handleSipInfoPrivateS, peerInfo, weakRef().toStrongRef() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QWeakPointer<ConnectionManager>
|
QWeakPointer<ConnectionManager>
|
||||||
ConnectionManager::weakRef() const
|
ConnectionManager::weakRef() const
|
||||||
{
|
{
|
||||||
return d_func()->ownRef;
|
return d_func()->ownRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ConnectionManager::setWeakRef( QWeakPointer<ConnectionManager> weakRef )
|
ConnectionManager::setWeakRef( QWeakPointer<ConnectionManager> weakRef )
|
||||||
{
|
{
|
||||||
@@ -302,7 +309,9 @@ ConnectionManager::connectToPeer( const Tomahawk::peerinfo_ptr &peerInfo, bool l
|
|||||||
tryConnect();
|
tryConnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionManager::tryConnect()
|
|
||||||
|
void
|
||||||
|
ConnectionManager::tryConnect()
|
||||||
{
|
{
|
||||||
// ATTENTION: mutex should be already locked by the calling function.
|
// ATTENTION: mutex should be already locked by the calling function.
|
||||||
Q_ASSERT( !d_func()->controlConnection.isNull() );
|
Q_ASSERT( !d_func()->controlConnection.isNull() );
|
||||||
@@ -365,6 +374,7 @@ void ConnectionManager::tryConnect()
|
|||||||
sock->moveToThread( Servent::instance()->thread() );
|
sock->moveToThread( Servent::instance()->thread() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ConnectionManager::socketError( QAbstractSocket::SocketError error )
|
ConnectionManager::socketError( QAbstractSocket::SocketError error )
|
||||||
{
|
{
|
||||||
@@ -379,12 +389,14 @@ ConnectionManager::socketError( QAbstractSocket::SocketError error )
|
|||||||
tryConnect();
|
tryConnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ConnectionManager::handleSipInfoPrivateS( const Tomahawk::peerinfo_ptr &peerInfo, const QSharedPointer<ConnectionManager> &connectionManager )
|
ConnectionManager::handleSipInfoPrivateS( const Tomahawk::peerinfo_ptr &peerInfo, const QSharedPointer<ConnectionManager> &connectionManager )
|
||||||
{
|
{
|
||||||
connectionManager->handleSipInfoPrivate( peerInfo );
|
connectionManager->handleSipInfoPrivate( peerInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ConnectionManager::activate()
|
ConnectionManager::activate()
|
||||||
{
|
{
|
||||||
@@ -392,6 +404,7 @@ ConnectionManager::activate()
|
|||||||
setActive( true, d_func()->nodeid, weakRef().toStrongRef() );
|
setActive( true, d_func()->nodeid, weakRef().toStrongRef() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ConnectionManager::deactivate()
|
ConnectionManager::deactivate()
|
||||||
{
|
{
|
||||||
@@ -419,6 +432,7 @@ ConnectionManager::socketConnected()
|
|||||||
connect( d->controlConnection.data(), SIGNAL( authTimeout() ), SLOT( authFailed() ) );
|
connect( d->controlConnection.data(), SIGNAL( authTimeout() ), SLOT( authFailed() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ConnectionManager::handoverSocket( QTcpSocketExtra* sock )
|
ConnectionManager::handoverSocket( QTcpSocketExtra* sock )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user