Пример #1
0
void
DatabaseResolver::resolve( const Tomahawk::query_ptr& query )
{
    Tomahawk::DatabaseCommand_Resolve* cmd = new Tomahawk::DatabaseCommand_Resolve( query );

    connect( cmd, SIGNAL( results( Tomahawk::QID, QList< Tomahawk::result_ptr > ) ),
             SLOT( gotResults( Tomahawk::QID, QList< Tomahawk::result_ptr > ) ), Qt::QueuedConnection );
    connect( cmd, SIGNAL( albums( Tomahawk::QID, QList< Tomahawk::album_ptr > ) ),
             SLOT( gotAlbums( Tomahawk::QID, QList< Tomahawk::album_ptr > ) ), Qt::QueuedConnection );
    connect( cmd, SIGNAL( artists( Tomahawk::QID, QList< Tomahawk::artist_ptr > ) ),
             SLOT( gotArtists( Tomahawk::QID, QList< Tomahawk::artist_ptr > ) ), Qt::QueuedConnection );

    Tomahawk::Database::instance()->enqueue( Tomahawk::dbcmd_ptr( cmd ) );

}
bool PageNetTest::collectResults() {

	CollectionRec *cr = g_collectiondb.getRec ( m_coll );

	if( m_numResultsSent >= g_hostdb.getNumHosts() ) return true;
		
	char temp[64];
	long ip = g_hostdb.getHost( m_numResultsSent )->m_ip;
	long port = g_hostdb.getHost( m_numResultsSent )->m_httpPort;
	//long len = 0;
	sprintf(temp, "http://%s:%li/get?rnettest=1", iptoa(ip), port);
	log( LOG_DEBUG, "net: nettest: queried results from: %s", temp );
	
	//Url u;
	//u.set( temp, len );
	m_numResultsSent++;

	if ( ! g_httpServer.getDoc ( temp ,// &u                , 
				     0 , // ip
				     0                 , //offset
				     -1                , //size
				     0                 , //modifiedSince
				     this              , //state
				     gotResultsWrapper , //callback
				     30*1000           , //timeout
				     cr->m_proxyIp     , //proxyIp
				     cr->m_proxyPort   , //proxyPort
				     200               , //maxTextLen
				     200               ) ) return false;
	if ( g_errno ) {
		g_errno = 0;
		return gotResults ( NULL );
	}

	return true;
}