1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

* This should fix sources being stuck in 'Parsing'.

This commit is contained in:
Christian Muehlhaeuser
2011-11-18 11:39:47 +01:00
parent 0c0a2ea55c
commit b9537802e3
4 changed files with 9 additions and 12 deletions

View File

@@ -276,14 +276,15 @@ Connection::socketDisconnected()
} }
} }
void 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 ) if ( e == QAbstractSocket::RemoteHostClosedError )
return; return;
qDebug() << "SOCKET ERROR CODE" << e << this->name() << "CALLING Connection::shutdown(false)";
m_peer_disconnected = true; m_peer_disconnected = true;
emit socketErrored(e); emit socketErrored(e);

View File

@@ -63,7 +63,7 @@ DBSyncConnection::DBSyncConnection( Servent* s, const source_ptr& src )
DBSyncConnection::~DBSyncConnection() DBSyncConnection::~DBSyncConnection()
{ {
tDebug() << "DTOR" << Q_FUNC_INFO << m_source->friendlyName(); tDebug() << "DTOR" << Q_FUNC_INFO << m_source->id() << m_source->friendlyName();
m_state = SHUTDOWN; m_state = SHUTDOWN;
} }
@@ -117,8 +117,6 @@ DBSyncConnection::check()
} }
m_uscache.clear(); m_uscache.clear();
m_us.clear();
changeState( CHECKING ); changeState( CHECKING );
// load last-modified etc data for our collection and theirs from our DB: // load last-modified etc data for our collection and theirs from our DB:
@@ -144,7 +142,6 @@ DBSyncConnection::check()
void void
DBSyncConnection::gotUs( const QVariantMap& m ) DBSyncConnection::gotUs( const QVariantMap& m )
{ {
m_us = m;
if ( !m_uscache.empty() ) if ( !m_uscache.empty() )
sendOps(); sendOps();
} }
@@ -227,7 +224,6 @@ DBSyncConnection::handleMsg( msg_ptr msg )
if ( m.value( "method" ).toString() == "fetchops" ) if ( m.value( "method" ).toString() == "fetchops" )
{ {
m_uscache = m; m_uscache = m;
if ( !m_us.empty() )
sendOps(); sendOps();
return; return;
} }
@@ -278,6 +274,7 @@ DBSyncConnection::sendOpsData( QString sinceguid, QString lastguid, QList< dbop_
m_lastSentOp = lastguid; m_lastSentOp = lastguid;
if ( ops.length() == 0 ) if ( ops.length() == 0 )
{ {
tDebug() << "Sending ok" << m_source->id() << m_source->friendlyName();
sendMsg( Msg::factory( "ok", Msg::DBOP ) ); sendMsg( Msg::factory( "ok", Msg::DBOP ) );
return; return;
} }

View File

@@ -79,7 +79,7 @@ private:
void changeState( State newstate ); void changeState( State newstate );
Tomahawk::source_ptr m_source; Tomahawk::source_ptr m_source;
QVariantMap m_us, m_uscache; QVariantMap m_uscache;
QString m_lastSentOp; QString m_lastSentOp;

View File

@@ -97,6 +97,7 @@ Source::setStats( const QVariantMap& m )
{ {
m_stats = m; m_stats = m;
emit stats( m_stats ); emit stats( m_stats );
emit stateChanged();
} }
@@ -431,8 +432,6 @@ Source::updateTracks()
connect( cmd, SIGNAL( done( QVariantMap ) ), connect( cmd, SIGNAL( done( QVariantMap ) ),
this, SLOT( setStats( QVariantMap ) ), Qt::QueuedConnection ); this, SLOT( setStats( QVariantMap ) ), Qt::QueuedConnection );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) ); Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
connect( cmd, SIGNAL( finished() ), SIGNAL( stateChanged() ) );
} }
} }