Changeset 400 for trunk/libtransmission


Ignore:
Timestamp:
Jun 20, 2006, 12:28:16 AM (15 years ago)
Author:
titer
Message:

Fixes scraping with transmissioncli (#79)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tracker.c

    r261 r400  
    610610    uint64_t date;
    611611    int pos, len;
     612    tr_resolve_t * resolve;
    612613
    613614    if( !tor->scrape[0] )
     
    617618    }
    618619
    619     if( tr_netResolve( inf->trackerAddress, &addr ) )
    620     {
    621         return 0;
    622     }
     620    resolve = tr_netResolveInit( inf->trackerAddress );
     621    for( date = tr_date();; )
     622    {
     623        ret = tr_netResolvePulse( resolve, &addr );
     624        if( ret == TR_RESOLVE_OK )
     625        {
     626            tr_netResolveClose( resolve );
     627            break;
     628        }
     629        if( ret == TR_RESOLVE_ERROR ||
     630            ( ret == TR_RESOLVE_WAIT && tr_date() > date + 10000 ) )
     631        {
     632            fprintf( stderr, "Could not resolve %s\n", inf->trackerAddress );
     633            tr_netResolveClose( resolve );
     634            return 1;
     635        }
     636        tr_wait( 10 );
     637    }
     638
    623639    s = tr_netOpen( addr, htons( inf->trackerPort ) );
    624640    if( s < 0 )
Note: See TracChangeset for help on using the changeset viewer.