1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 03:10:12 +02:00

Make selection of ControlConnection symmetric

This commit is contained in:
Uwe L. Korn
2013-06-26 19:00:01 +02:00
parent 583053661f
commit 968ac83906

View File

@@ -106,7 +106,8 @@ Source::setControlConnection( ControlConnection* cc )
{
const QString& nodeid = Database::instance()->impl()->dbid();
peerInfoDebug( (*cc->peerInfos().begin()) ) << Q_FUNC_INFO << "Comparing" << cc->id() << "and" << nodeid << "to detect duplicate connection, outbound:" << cc->outbound();
if ( cc->id() < nodeid && d->cc->outbound() )
// If our nodeid is "higher" than the other, we prefer inbound connection, else outbound.
if ( ( cc->id() < nodeid && d->cc->outbound() ) || ( cc->id() > nodeid && !d->cc->outbound() ) )
{
// Tell the ControlConnection it is not anymore responsible for us.
d->cc->unbindFromSource();