Changeset 3139


Ignore:
Timestamp:
Sep 22, 2007, 2:32:02 PM (14 years ago)
Author:
charles
Message:

tweak the peer mgr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r3138 r3139  
    639639            const int peerIsSeed = e->progress >= 1.0;
    640640            if( clientIsSeed && peerIsSeed ) {
    641                 fprintf( stderr, "DISCONNECTING FROM PEER because both of us are seeds\n" );
     641                fprintf( stderr, "DISCONNECTING FROM PEER %s because both of us are seeds\n", tr_peerIoGetAddrStr(peer->io) );
    642642                peer->doDisconnect = 1;
    643643            }
     
    650650
    651651        case TR_PEERMSG_GOT_ERROR:
     652            fprintf( stderr, "DISCONNECTING FROM PEER %s because we got an error\n", tr_peerIoGetAddrStr(peer->io));
    652653            peer->doDisconnect = 1;
    653654            reconnectSoon( t );
     
    12091210    const int isSeeding = tr_cpGetStatus( t->tor->completion ) != TR_CP_INCOMPLETE;
    12101211
    1211 fprintf( stderr, "[%s] doing upkeep on our peer connections\n", t->tor->info.name );
    1212 
    12131212    /* how many connections do we have? */
    12141213    for( i=liveCount=0; i<size; ++i )
     
    12201219        tr_peer * peer = peers[i];
    12211220        if( shouldPeerBeDisconnected( t, peer, liveCount, isSeeding ) ) {
    1222             fprintf( stderr, "%s is a bum.  I'm hanging up on them.\n", tr_peerIoGetAddrStr(peer->io) );
     1221            fprintf( stderr, "[%s] %s is a bum.  I'm hanging up on them.\n", t->tor->info.name, tr_peerIoGetAddrStr(peer->io) );
    12231222            disconnectPeer( peer );
    12241223            --liveCount;
     
    12471246        qsort( pool, poolSize, sizeof(tr_peer*), comparePeerByConnectionDate );
    12481247
    1249         /* debugging */
    1250         if( poolSize > 0 ) {
    1251             fprintf( stderr, "here are some peers that I might want to connect to: \n" );
    1252             for( i=0; i<poolSize; ++i )
    1253                 fprintf( stderr, "%"PRIu64", ", (uint64_t)pool[i]->connectionChangedAt );
    1254             fprintf( stderr, "\n" );
    1255         }
    1256 
    12571248        /* make some connections */
    12581249        for( i=0; i<poolSize && left>0; ++i )
     
    12611252            tr_peerIo * io;
    12621253
    1263             if( ( now - peer->connectionChangedAt ) < MIN_HANGUP_PERIOD_SEC ) {
    1264                 fprintf( stderr, "out of candidates\n" );
     1254            if( ( now - peer->connectionChangedAt ) < MIN_HANGUP_PERIOD_SEC )
    12651255                break;
    1266             }
    12671256
    12681257            /* already have a handshake pending */
    1269             if( getExistingHandshake( manager, &peer->in_addr ) != NULL ) {
    1270                 fprintf( stderr, "already have a handshake for that address\n" );
     1258            if( getExistingHandshake( manager, &peer->in_addr ) != NULL )
    12711259                continue;
    1272             }
    12731260
    12741261            /* initiate a connection to the peer */
    12751262            io = tr_peerIoNewOutgoing( manager->handle, &peer->in_addr, peer->port, t->hash );
    1276             fprintf( stderr, "we haven't tried %s in awhile...\n", tr_peerIoGetAddrStr(io) );
     1263            fprintf( stderr, "[%s] connecting to potential peer %s\n", t->tor->info.name, tr_peerIoGetAddrStr(io) );
    12771264            peer->connectionChangedAt = time( NULL );
    12781265            initiateHandshake( manager, io );
Note: See TracChangeset for help on using the changeset viewer.