Changeset 11945


Ignore:
Timestamp:
Feb 18, 2011, 12:41:06 AM (11 years ago)
Author:
jordan
Message:

if we successfully finish a handshake using uTP, mark the peer as supporting uTP

Location:
trunk/libtransmission
Files:
5 edited

Legend:

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

    r11943 r11945  
    427427
    428428    if( state == UTP_STATE_CONNECT ) {
    429         dbgmsg( io, "utp_on_state_change -- changed to readable" );
     429        dbgmsg( io, "utp_on_state_change -- changed to connected" );
     430        io->dhtSupported = TRUE;
    430431    } else if( state == UTP_STATE_WRITABLE ) {
    431432        dbgmsg( io, "utp_on_state_change -- changed to writable" );
  • trunk/libtransmission/peer-io.h

    r11935 r11945  
    7272    tr_bool               fastExtensionSupported;
    7373    tr_bool               dhtSupported;
     74    tr_bool               utpSupported;
    7475
    7576    tr_priority_t         priority;
     
    178179}
    179180
     181static inline tr_bool tr_peerIoSupportsUTP( const tr_peerIo * io )
     182{
     183    return io->dhtSupported;
     184}
     185
    180186/**
    181187***
  • trunk/libtransmission/peer-mgr.c

    r11933 r11945  
    671671    return isSeed;
    672672}
     673
     674void
     675tr_peerMgrSetUtpSupported( tr_torrent * tor, const tr_address * addr )
     676{
     677    struct peer_atom * atom = getExistingAtom( tor->torrentPeers, addr );
     678
     679    if( atom )
     680        atom->flags |= ADDED_F_UTP_FLAGS;
     681}
     682
    673683
    674684/**
  • trunk/libtransmission/peer-mgr.h

    r11903 r11945  
    150150                              const tr_address * addr );
    151151
     152void tr_peerMgrSetUtpSupported( tr_torrent       * tor,
     153                                const tr_address * addr );
     154
    152155void tr_peerMgrGetNextRequests( tr_torrent          * torrent,
    153156                                tr_peer             * peer,
  • trunk/libtransmission/peer-msgs.c

    r11937 r11945  
    23772377    tr_timerAdd( m->pexTimer, PEX_INTERVAL_SECS, 0 );
    23782378
     2379    if( tr_peerIoSupportsUTP( peer->io ) ) {
     2380        const tr_address * addr = tr_peerIoGetAddress( peer->io, NULL );
     2381        tr_peerMgrSetUtpSupported( torrent, addr );
     2382    }
     2383
    23792384    if( tr_peerIoSupportsLTEP( peer->io ) )
    23802385        sendLtepHandshake( m );
Note: See TracChangeset for help on using the changeset viewer.