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

* Abort connection only when trying to connect to same host and port.

This commit is contained in:
Christian Muehlhaeuser
2014-07-26 16:34:41 +02:00
parent 5d720e6595
commit 5ee1fb435e

View File

@@ -384,7 +384,7 @@ Servent::lookupControlConnection( const SipInfo& sipInfo )
{ {
Q_D( Servent ); Q_D( Servent );
QMutexLocker locker( &d->controlconnectionsMutex ); QMutexLocker locker( &d->controlconnectionsMutex );
foreach ( ControlConnection* c, d_func()->controlconnections ) foreach ( ControlConnection* c, d_func()->controlconnections )
{ {
tLog() << sipInfo.port() << c->peerPort() << sipInfo.host() << c->peerIpAddress().toString(); tLog() << sipInfo.port() << c->peerPort() << sipInfo.host() << c->peerIpAddress().toString();
@@ -401,7 +401,7 @@ Servent::lookupControlConnection( const QString& nodeid )
{ {
Q_D( Servent ); Q_D( Servent );
QMutexLocker locker( &d->controlconnectionsMutex ); QMutexLocker locker( &d->controlconnectionsMutex );
foreach ( ControlConnection* c, d_func()->controlconnections ) foreach ( ControlConnection* c, d_func()->controlconnections )
{ {
if ( c->id() == nodeid ) if ( c->id() == nodeid )
@@ -898,13 +898,13 @@ Servent::initiateConnection( const SipInfo& sipInfo, Connection* conn )
foreach ( QHostAddress ha, addresses ) foreach ( QHostAddress ha, addresses )
{ {
if ( sipInfo.host() == ha.toString() ) if ( sipInfo.host() == ha.toString() && sipInfo.port() == d_func()->port )
{ {
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Tomahawk won't try to connect to" << sipInfo.host() << ":" << sipInfo.port() << ": same IP as ourselves."; tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Tomahawk won't try to connect to" << sipInfo.host() << ":" << sipInfo.port() << ": same IP as ourselves.";
return; return;
} }
} }
if ( sipInfo.host() == d_func()->externalHostname ) if ( sipInfo.host() == d_func()->externalHostname && sipInfo.port() == d_func()->port )
{ {
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Tomahawk won't try to connect to" << sipInfo.host() << ":" << sipInfo.port() << ": same IP as ourselves."; tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Tomahawk won't try to connect to" << sipInfo.host() << ":" << sipInfo.port() << ": same IP as ourselves.";
return; return;
@@ -1131,7 +1131,7 @@ Connection*
Servent::claimOffer( ControlConnection* cc, const QString &nodeid, const QString &key, const QHostAddress peer ) Servent::claimOffer( ControlConnection* cc, const QString &nodeid, const QString &key, const QHostAddress peer )
{ {
Q_D( Servent ); Q_D( Servent );
// magic key for stream connections: // magic key for stream connections:
if ( key.startsWith( "FILE_REQUEST_KEY:" ) ) if ( key.startsWith( "FILE_REQUEST_KEY:" ) )
{ {