1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01:00

Handle disconnects during connection attempts (i.e. vanishing connection objects)

This commit is contained in:
Uwe L. Korn 2013-05-14 13:06:27 +02:00
parent 03cdb474c1
commit d71a237533

View File

@ -851,7 +851,11 @@ Servent::connectToPeer(const peerinfo_ptr& peerInfo, const QList<SipInfo>& sipIn
{
if ( sipInfos.isEmpty() )
{
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "No more possible SIP endpoints for " << conn->name() << " skipping.";
if ( conn != NULL ) {
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "No more possible SIP endpoints for " << conn->name() << " skipping.";
} else {
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "No more possible SIP endpoints for <null connection> skipping.";
}
// If a peerinfo was supplied and has a ControlConnection which should be destroyed, than use this
if ( !peerInfo.isNull() && peerInfo->controlConnection() )
delete peerInfo->controlConnection();
@ -922,10 +926,13 @@ Servent::connectToPeer(const peerinfo_ptr& peerInfo, const QList<SipInfo>& sipIn
void
Servent::connectToPeerFailed( const peerinfo_ptr& peerInfo, QList<SipInfo> sipInfo, Connection* conn, QTcpSocketExtra* socket )
{
bool connIsNull = socket->_conn.isNull();
cleanupSocket( socket );
// Try next SipInfo
connectToPeer( peerInfo, sipInfo, conn );
if ( !connIsNull ) {
// Try next SipInfo (don't do this if the connection was destroyed in between)
connectToPeer( peerInfo, sipInfo, conn );
}
}
void