mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 20:00:13 +02:00
* This should fix crashes / asserts in Servent.
This commit is contained in:
@@ -254,7 +254,9 @@ void
|
||||
Servent::registerControlConnection( ControlConnection* conn )
|
||||
{
|
||||
Q_ASSERT( conn );
|
||||
m_controlconnections.append( conn );
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO << conn->name();
|
||||
m_controlconnections << conn;
|
||||
m_connectedNodes << conn->id();
|
||||
}
|
||||
|
||||
|
||||
@@ -262,6 +264,7 @@ void
|
||||
Servent::unregisterControlConnection( ControlConnection* conn )
|
||||
{
|
||||
Q_ASSERT( conn );
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO << conn->name();
|
||||
m_connectedNodes.removeAll( conn->id() );
|
||||
m_controlconnections.removeAll( conn );
|
||||
}
|
||||
@@ -481,8 +484,7 @@ Servent::readyRead()
|
||||
|
||||
foreach ( ControlConnection* con, m_controlconnections )
|
||||
{
|
||||
if ( !con )
|
||||
continue;
|
||||
Q_ASSERT( con );
|
||||
|
||||
tLog() << "known connection:" << con->id();
|
||||
if ( con->id() == nodeid )
|
||||
@@ -529,7 +531,9 @@ Servent::readyRead()
|
||||
|
||||
foreach ( ControlConnection* con, m_controlconnections )
|
||||
{
|
||||
if ( con && con->id() == controlid )
|
||||
Q_ASSERT( con );
|
||||
|
||||
if ( con->id() == controlid )
|
||||
{
|
||||
cc = con;
|
||||
break;
|
||||
@@ -559,11 +563,11 @@ Servent::readyRead()
|
||||
}
|
||||
tDebug( LOGVERBOSE ) << "claimOffer OK:" << key << nodeid;
|
||||
|
||||
registerControlConnection( qobject_cast<ControlConnection*>(conn) );
|
||||
|
||||
m_connectedNodes << nodeid;
|
||||
if ( !nodeid.isEmpty() )
|
||||
{
|
||||
conn->setId( nodeid );
|
||||
registerControlConnection( qobject_cast<ControlConnection*>(conn) );
|
||||
}
|
||||
|
||||
handoverSocket( conn, sock.data() );
|
||||
return;
|
||||
@@ -749,20 +753,19 @@ Servent::connectToPeer( const peerinfo_ptr& peerInfo )
|
||||
m["nodeid"] = Database::instance()->impl()->dbid();
|
||||
|
||||
peerInfoDebug(peerInfo) << "No match found, creating a new ControlConnection...";
|
||||
|
||||
conn = new ControlConnection( this );
|
||||
conn->addPeerInfo( peerInfo );
|
||||
conn->setFirstMessage( m );
|
||||
|
||||
if ( peerInfo->id().length() )
|
||||
conn->setName( peerInfo->id() );
|
||||
|
||||
if ( sipInfo.uniqname().length() )
|
||||
conn->setId( sipInfo.uniqname() );
|
||||
|
||||
conn->setProperty( "nodeid", sipInfo.uniqname() );
|
||||
|
||||
registerControlConnection( conn );
|
||||
|
||||
connectToPeer( sipInfo.host(), sipInfo.port(), sipInfo.key(), conn );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user