mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-13 01:24:11 +02:00
* Added extra debug output to ControlConnection.
This commit is contained in:
@@ -158,7 +158,7 @@ ControlConnection::registerSource()
|
|||||||
|
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
// qDebug() << Q_FUNC_INFO << "Setting avatar ... " << name() << !SipHandler::instance()->avatar( name() ).isNull();
|
// qDebug() << Q_FUNC_INFO << "Setting avatar ... " << name() << !SipHandler::instance()->avatar( name() ).isNull();
|
||||||
if( !SipHandler::instance()->avatar( name() ).isNull() )
|
if ( !SipHandler::instance()->avatar( name() ).isNull() )
|
||||||
{
|
{
|
||||||
source->setAvatar( SipHandler::instance()->avatar( name() ) );
|
source->setAvatar( SipHandler::instance()->avatar( name() ) );
|
||||||
}
|
}
|
||||||
@@ -180,7 +180,7 @@ ControlConnection::setupDbSyncConnection( bool ondemand )
|
|||||||
|
|
||||||
Q_ASSERT( m_source->id() > 0 );
|
Q_ASSERT( m_source->id() > 0 );
|
||||||
|
|
||||||
if( !m_dbconnkey.isEmpty() )
|
if ( !m_dbconnkey.isEmpty() )
|
||||||
{
|
{
|
||||||
qDebug() << "Connecting to DBSync offer from peer...";
|
qDebug() << "Connecting to DBSync offer from peer...";
|
||||||
m_dbsyncconn = new DBSyncConnection( m_servent, m_source );
|
m_dbsyncconn = new DBSyncConnection( m_servent, m_source );
|
||||||
@@ -188,7 +188,7 @@ ControlConnection::setupDbSyncConnection( bool ondemand )
|
|||||||
m_servent->createParallelConnection( this, m_dbsyncconn, m_dbconnkey );
|
m_servent->createParallelConnection( this, m_dbsyncconn, m_dbconnkey );
|
||||||
m_dbconnkey.clear();
|
m_dbconnkey.clear();
|
||||||
}
|
}
|
||||||
else if( !outbound() || ondemand ) // only one end makes the offer
|
else if ( !outbound() || ondemand ) // only one end makes the offer
|
||||||
{
|
{
|
||||||
qDebug() << "Offering a DBSync key to peer...";
|
qDebug() << "Offering a DBSync key to peer...";
|
||||||
m_dbsyncconn = new DBSyncConnection( m_servent, m_source );
|
m_dbsyncconn = new DBSyncConnection( m_servent, m_source );
|
||||||
@@ -216,7 +216,7 @@ void
|
|||||||
ControlConnection::dbSyncConnFinished( QObject* c )
|
ControlConnection::dbSyncConnFinished( QObject* c )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "DBSync connection closed (for now)";
|
qDebug() << Q_FUNC_INFO << "DBSync connection closed (for now)";
|
||||||
if( (DBSyncConnection*)c == m_dbsyncconn )
|
if ( (DBSyncConnection*)c == m_dbsyncconn )
|
||||||
{
|
{
|
||||||
//qDebug() << "Setting m_dbsyncconn to NULL";
|
//qDebug() << "Setting m_dbsyncconn to NULL";
|
||||||
m_dbsyncconn = NULL;
|
m_dbsyncconn = NULL;
|
||||||
@@ -251,13 +251,13 @@ ControlConnection::handleMsg( msg_ptr msg )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if small and not compresed, print it out for debug
|
// if small and not compresed, print it out for debug
|
||||||
if( msg->length() < 1024 && !msg->is( Msg::COMPRESSED ) )
|
if ( msg->length() < 1024 && !msg->is( Msg::COMPRESSED ) )
|
||||||
{
|
{
|
||||||
qDebug() << id() << "got msg:" << QString::fromAscii( msg->payload() );
|
qDebug() << id() << "got msg:" << QString::fromAscii( msg->payload() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// All control connection msgs are JSON
|
// All control connection msgs are JSON
|
||||||
if( !msg->is( Msg::JSON ) )
|
if ( !msg->is( Msg::JSON ) )
|
||||||
{
|
{
|
||||||
Q_ASSERT( msg->is( Msg::JSON ) );
|
Q_ASSERT( msg->is( Msg::JSON ) );
|
||||||
markAsFailed();
|
markAsFailed();
|
||||||
@@ -265,21 +265,21 @@ ControlConnection::handleMsg( msg_ptr msg )
|
|||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap m = msg->json().toMap();
|
QVariantMap m = msg->json().toMap();
|
||||||
if( !m.isEmpty() )
|
if ( !m.isEmpty() )
|
||||||
{
|
{
|
||||||
if( m.value("conntype").toString() == "request-offer" )
|
if ( m.value( "conntype" ).toString() == "request-offer" )
|
||||||
{
|
{
|
||||||
QString theirkey = m["key"].toString();
|
QString theirkey = m["key"].toString();
|
||||||
QString ourkey = m["offer"].toString();
|
QString ourkey = m["offer"].toString();
|
||||||
QString theirdbid = m["controlid"].toString();
|
QString theirdbid = m["controlid"].toString();
|
||||||
servent()->reverseOfferRequest( this, theirdbid, ourkey, theirkey );
|
servent()->reverseOfferRequest( this, theirdbid, ourkey, theirkey );
|
||||||
}
|
}
|
||||||
else if( m.value( "method" ).toString() == "dbsync-offer" )
|
else if ( m.value( "method" ).toString() == "dbsync-offer" )
|
||||||
{
|
{
|
||||||
m_dbconnkey = m.value( "key" ).toString() ;
|
m_dbconnkey = m.value( "key" ).toString() ;
|
||||||
setupDbSyncConnection();
|
setupDbSyncConnection();
|
||||||
}
|
}
|
||||||
else if( m.value( "method" ) == "protovercheckfail" )
|
else if ( m.value( "method" ) == "protovercheckfail" )
|
||||||
{
|
{
|
||||||
qDebug() << "*** Remote peer protocol version mismatch, connection closed";
|
qDebug() << "*** Remote peer protocol version mismatch, connection closed";
|
||||||
shutdown( true );
|
shutdown( true );
|
||||||
@@ -287,13 +287,13 @@ ControlConnection::handleMsg( msg_ptr msg )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << id() << "Unhandled msg:" << QString::fromAscii( msg->payload() );
|
tDebug() << id() << "Unhandled msg:" << QString::fromAscii( msg->payload() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << id() << "Invalid msg:" << QString::fromAscii(msg->payload());
|
tDebug() << id() << "Invalid msg:" << QString::fromAscii( msg->payload() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user