From b9537802e3464581f702135365767abeed188b97 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 18 Nov 2011 11:39:47 +0100 Subject: [PATCH] * This should fix sources being stuck in 'Parsing'. --- src/libtomahawk/network/connection.cpp | 7 ++++--- src/libtomahawk/network/dbsyncconnection.cpp | 9 +++------ src/libtomahawk/network/dbsyncconnection.h | 2 +- src/libtomahawk/source.cpp | 3 +-- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/libtomahawk/network/connection.cpp b/src/libtomahawk/network/connection.cpp index 6983c05df..0700af2a6 100644 --- a/src/libtomahawk/network/connection.cpp +++ b/src/libtomahawk/network/connection.cpp @@ -276,14 +276,15 @@ Connection::socketDisconnected() } } + void -Connection::socketDisconnectedError(QAbstractSocket::SocketError e) +Connection::socketDisconnectedError( QAbstractSocket::SocketError e ) { + qDebug() << "SOCKET ERROR CODE" << e << this->name() << "CALLING Connection::shutdown(false)"; + if ( e == QAbstractSocket::RemoteHostClosedError ) return; - qDebug() << "SOCKET ERROR CODE" << e << this->name() << "CALLING Connection::shutdown(false)"; - m_peer_disconnected = true; emit socketErrored(e); diff --git a/src/libtomahawk/network/dbsyncconnection.cpp b/src/libtomahawk/network/dbsyncconnection.cpp index b1043cc6a..544089a6a 100644 --- a/src/libtomahawk/network/dbsyncconnection.cpp +++ b/src/libtomahawk/network/dbsyncconnection.cpp @@ -63,7 +63,7 @@ DBSyncConnection::DBSyncConnection( Servent* s, const source_ptr& src ) DBSyncConnection::~DBSyncConnection() { - tDebug() << "DTOR" << Q_FUNC_INFO << m_source->friendlyName(); + tDebug() << "DTOR" << Q_FUNC_INFO << m_source->id() << m_source->friendlyName(); m_state = SHUTDOWN; } @@ -117,8 +117,6 @@ DBSyncConnection::check() } m_uscache.clear(); - m_us.clear(); - changeState( CHECKING ); // load last-modified etc data for our collection and theirs from our DB: @@ -144,7 +142,6 @@ DBSyncConnection::check() void DBSyncConnection::gotUs( const QVariantMap& m ) { - m_us = m; if ( !m_uscache.empty() ) sendOps(); } @@ -227,8 +224,7 @@ DBSyncConnection::handleMsg( msg_ptr msg ) if ( m.value( "method" ).toString() == "fetchops" ) { m_uscache = m; - if ( !m_us.empty() ) - sendOps(); + sendOps(); return; } @@ -278,6 +274,7 @@ DBSyncConnection::sendOpsData( QString sinceguid, QString lastguid, QList< dbop_ m_lastSentOp = lastguid; if ( ops.length() == 0 ) { + tDebug() << "Sending ok" << m_source->id() << m_source->friendlyName(); sendMsg( Msg::factory( "ok", Msg::DBOP ) ); return; } diff --git a/src/libtomahawk/network/dbsyncconnection.h b/src/libtomahawk/network/dbsyncconnection.h index 247d05cf9..5ed13516e 100644 --- a/src/libtomahawk/network/dbsyncconnection.h +++ b/src/libtomahawk/network/dbsyncconnection.h @@ -79,7 +79,7 @@ private: void changeState( State newstate ); Tomahawk::source_ptr m_source; - QVariantMap m_us, m_uscache; + QVariantMap m_uscache; QString m_lastSentOp; diff --git a/src/libtomahawk/source.cpp b/src/libtomahawk/source.cpp index 6f6902871..6ef74bd46 100644 --- a/src/libtomahawk/source.cpp +++ b/src/libtomahawk/source.cpp @@ -97,6 +97,7 @@ Source::setStats( const QVariantMap& m ) { m_stats = m; emit stats( m_stats ); + emit stateChanged(); } @@ -431,8 +432,6 @@ Source::updateTracks() connect( cmd, SIGNAL( done( QVariantMap ) ), this, SLOT( setStats( QVariantMap ) ), Qt::QueuedConnection ); Database::instance()->enqueue( QSharedPointer( cmd ) ); - - connect( cmd, SIGNAL( finished() ), SIGNAL( stateChanged() ) ); } }