1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-05 00:22:31 +02:00

Change resultchecker to have userData field to specify arbitrary user data associated with checks

This commit is contained in:
Anton Romanov 2015-05-15 14:38:35 -07:00
parent 6250a19a1f
commit 9a4f1e045f
3 changed files with 9 additions and 8 deletions

View File

@ -430,7 +430,7 @@ Pipeline::onResultUrlCheckerDone( )
return;
}*/
decQIDState( q, reinterpret_cast<Tomahawk::Resolver*>( checker->resolver() ) );
decQIDState( q, reinterpret_cast<Tomahawk::Resolver*>( checker->userData() ) );
}
@ -567,12 +567,13 @@ Pipeline::shunt( const query_ptr& q )
auto timeout = r->timeout();
if ( timeout == 0 )
timeout = DEFAULT_RESOLVER_TIMEOUT;
new FuncTimeout( r->timeout(), std::bind( &Pipeline::timeoutShunt, this, q, r ), this );
new FuncTimeout( timeout, std::bind( &Pipeline::timeoutShunt, this, q, r ), this );
}
else
{
// we get here if we disable a resolver while a query is resolving
decQIDState(q, r);
// OR we are just out of resolvers while query is still resolving
return;
}

View File

@ -32,11 +32,11 @@
using namespace Tomahawk;
ResultUrlChecker::ResultUrlChecker( const query_ptr& query, void* r,
ResultUrlChecker::ResultUrlChecker( const query_ptr& query, QObject* userData,
const QList< result_ptr >& results )
: QObject( 0 )
, m_query( query )
, m_resolver( r )
, m_userData( userData )
, m_results( results )
{
check();

View File

@ -33,11 +33,11 @@ class ResultUrlChecker : public QObject
{
Q_OBJECT
public:
ResultUrlChecker( const query_ptr& query, void* r, const QList< result_ptr >& results );
ResultUrlChecker( const query_ptr& query, QObject* userData, const QList< result_ptr >& results );
virtual ~ResultUrlChecker();
query_ptr query() const { return m_query; }
void* resolver() const { return m_resolver; }
void* userData() const { return m_userData; }
QList< result_ptr > results() const { return m_results; }
QList< result_ptr > validResults() const { return m_validResults; }
@ -50,7 +50,7 @@ private slots:
private:
query_ptr m_query;
void* m_resolver;
QObject* m_userData;
QList< result_ptr > m_results;
QList< result_ptr > m_validResults;
QHash< NetworkReply*, Tomahawk::result_ptr > m_replies;