1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

Only destroy existing ControlConnection if it does not run anymore

This commit is contained in:
Uwe L. Korn
2013-05-17 00:25:37 +02:00
parent 527fb86608
commit 16d30a1072

View File

@@ -789,9 +789,16 @@ Servent::connectToPeer( const peerinfo_ptr& peerInfo )
peerInfoDebug( peerInfo ) << "connectToPeer: search for already established connections to the same nodeid:" << m_controlconnections.count() << "connections";
if ( peerInfo->controlConnection() )
{
peerInfoDebug( peerInfo ) << Q_FUNC_INFO << "deleting the existing Controlconnection";
if ( peerInfo->controlConnection()->isReady() && peerInfo->controlConnection()->isRunning() ) {
peerInfoDebug( peerInfo ) << Q_FUNC_INFO << "We have a running ControlConnection, so no use to connect.";
return;
}
else
{
peerInfoDebug( peerInfo ) << Q_FUNC_INFO << "deleting the existing ControlConnection";
delete peerInfo->controlConnection();
}
}
bool isDupe = false;
ControlConnection* conn = 0;