1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 21:57:41 +02:00

* Some more Servent cleanup.

This commit is contained in:
Christian Muehlhaeuser
2013-01-28 12:30:07 +01:00
parent c0e77ac633
commit 03fd8cc6fd

View File

@@ -360,6 +360,7 @@ Servent::registerPeer( const Tomahawk::peerinfo_ptr& peerInfo )
} }
} }
void void
Servent::onSipInfoChanged() Servent::onSipInfoChanged()
{ {
@@ -393,7 +394,7 @@ void Servent::handleSipInfo( const Tomahawk::peerinfo_ptr& peerInfo )
( externalAddress() == info.host() && externalPort() < info.port() ) ) ( externalAddress() == info.host() && externalPort() < info.port() ) )
{ {
tDebug() << "Initiate connection to" << peerInfo->id() << "at" << info.host() << " peer of: " << peerInfo->sipPlugin()->account()->accountFriendlyName(); tDebug() << "Initiate connection to" << peerInfo->id() << "at" << info.host() << "peer of:" << peerInfo->sipPlugin()->account()->accountFriendlyName();
connectToPeer( peerInfo ); connectToPeer( peerInfo );
} }
else else
@@ -704,23 +705,23 @@ Servent::connectToPeer( const peerinfo_ptr& peerInfo )
// try to find a ControlConnection with the same SipInfo, then we dont need to try to connect again // try to find a ControlConnection with the same SipInfo, then we dont need to try to connect again
foreach ( ControlConnection* c, m_controlconnections ) foreach ( ControlConnection* c, m_controlconnections )
{ {
if ( !c ) Q_ASSERT( c );
continue;
if ( c->id() == sipInfo.nodeId() ) if ( c->id() == sipInfo.nodeId() )
{ {
conn = c; conn = c;
foreach ( const peerinfo_ptr& currentPeerInfo, c->peerInfos() ) foreach ( const peerinfo_ptr& currentPeerInfo, c->peerInfos() )
{ {
peerInfoDebug( currentPeerInfo ) << "Same object: " << ( peerInfo == currentPeerInfo ) << ( peerInfo.data() == currentPeerInfo.data() ) << ( peerInfo->debugName() == currentPeerInfo->debugName() ); peerInfoDebug( currentPeerInfo ) << "Same object:" << ( peerInfo == currentPeerInfo ) << ( peerInfo.data() == currentPeerInfo.data() ) << ( peerInfo->debugName() == currentPeerInfo->debugName() );
if ( peerInfo == currentPeerInfo ) if ( peerInfo == currentPeerInfo )
{ {
isDupe = true; isDupe = true;
peerInfoDebug( currentPeerInfo ) << "Not adding, because it's a dupe: peerInfoCount remains the same " << conn->peerInfos().count(); peerInfoDebug( currentPeerInfo ) << "Not adding, because it's a dupe: peerInfoCount remains the same" << conn->peerInfos().count();
} break;
} }
}
if ( !c->peerInfos().contains( peerInfo ) ) if ( !c->peerInfos().contains( peerInfo ) )
{ {
@@ -736,11 +737,11 @@ Servent::connectToPeer( const peerinfo_ptr& peerInfo )
} }
} }
peerInfoDebug(peerInfo) << "connectToPeer: found a match: " << ( conn ? conn->name() : "false" ) << "dupe: " << isDupe; peerInfoDebug( peerInfo ) << "connectToPeer: found a match:" << ( conn ? conn->name() : "false" ) << "dupe:" << isDupe;
if ( isDupe ) if ( isDupe )
{ {
peerInfoDebug(peerInfo) << "it's a dupe, nothing to do here, returning and stopping processing: peerInfoCount:" << conn->peerInfos().count(); peerInfoDebug( peerInfo ) << "it's a dupe, nothing to do here, returning and stopping processing: peerInfoCount:" << conn->peerInfos().count();
} }
if ( conn ) if ( conn )