1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 00:09:47 +01: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,8 +789,15 @@ 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";
delete peerInfo->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;