~ubuntu-branches/ubuntu/maverick/transmission/maverick

« back to all changes in this revision

Viewing changes to libtransmission/tracker.c

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Klimonda
  • Date: 2009-05-22 21:57:30 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (2.1.18 sid) (1.3.8 upstream)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: james.westby@ubuntu.com-20090522215730-ly5kgv5aw9ig2u82
Tags: upstream-1.61
ImportĀ upstreamĀ versionĀ 1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * This exemption does not extend to derived works not owned by
8
8
 * the Transmission project.
9
9
 *
10
 
 * $Id: tracker.c 7897 2009-02-18 02:11:15Z charles $
 
10
 * $Id: tracker.c 8268 2009-04-21 16:52:28Z charles $
11
11
 */
12
12
 
13
13
#include <assert.h>
259
259
    {
260
260
        memcpy( &addr.addr.addr4, compactWalk, 4 );
261
261
        memcpy( &port, compactWalk + 4, 2 );
262
 
        tr_suspectAddress( &addr, "compact" );
263
262
        
264
263
        memcpy( walk, &addr, sizeof( addr ) );
265
264
        memcpy( walk + sizeof( addr ), &port, 2 );
292
291
        memcpy( &addr.addr.addr6, compactWalk, 16 );
293
292
        memcpy( &port, compactWalk + 16, 2 );
294
293
        compactWalk += 18;
295
 
        tr_suspectAddress( &addr, "compact6" );
296
294
        
297
295
        memcpy( walk, &addr, sizeof( addr ) );
298
296
        memcpy( walk + sizeof( addr ), &port, 2 );
346
344
    uint8_t * array, *walk;
347
345
    const int peerCount = bePeers->val.l.count;
348
346
 
349
 
    assert( bePeers->type == TYPE_LIST );
 
347
    assert( tr_bencIsList( bePeers ) );
350
348
 
351
349
    array = tr_new( uint8_t, peerCount * ( sizeof( tr_address ) + 2 ) );
352
350
 
368
366
            continue;
369
367
 
370
368
        memcpy( walk, &addr, sizeof( tr_address ) );
371
 
        tr_suspectAddress( &addr, "old tracker" );
372
369
        port = htons( itmp );
373
370
        memcpy( walk + sizeof( tr_address ), &port, 2 );
374
371
        walk += sizeof( tr_address ) + 2;
484
481
            {
485
482
                const int allAreSeeds = incomplete == 0;
486
483
 
487
 
                if( tmp->type == TYPE_STR ) /* "compact" extension */
 
484
                if( tr_bencIsString( tmp ) ) /* "compact" extension */
488
485
                {
489
486
                    publishNewPeersCompact( t, allAreSeeds, tmp->val.s.s,
490
487
                                            tmp->val.s.i );
491
488
                }
492
 
                else if( tmp->type == TYPE_LIST ) /* original protocol */
 
489
                else if( tr_bencIsList( tmp ) ) /* original protocol */
493
490
                {
494
491
                    size_t    byteCount = 0;
495
492
                    uint8_t * array = parseOldPeers( tmp, &byteCount );
502
499
            {
503
500
                const int allAreSeeds = incomplete == 0;
504
501
                
505
 
                if( tmp->type == TYPE_STR ) /* "compact" extension */
 
502
                if( tr_bencIsString( tmp ) ) /* "compact" extension */
506
503
                {
507
504
                    publishNewPeersCompact6( t, allAreSeeds, tmp->val.s.s,
508
505
                                             tmp->val.s.i );