mirror of
https://github.com/transmission/transmission
synced 2025-03-10 22:22:58 +00:00
if we successfully finish a handshake using uTP, mark the peer as supporting uTP
This commit is contained in:
parent
75badcd4ab
commit
f00799f80c
5 changed files with 26 additions and 1 deletions
|
@ -426,7 +426,8 @@ utp_on_state_change(void *closure, int state)
|
|||
assert( tr_isPeerIo( io ) );
|
||||
|
||||
if( state == UTP_STATE_CONNECT ) {
|
||||
dbgmsg( io, "utp_on_state_change -- changed to readable" );
|
||||
dbgmsg( io, "utp_on_state_change -- changed to connected" );
|
||||
io->dhtSupported = TRUE;
|
||||
} else if( state == UTP_STATE_WRITABLE ) {
|
||||
dbgmsg( io, "utp_on_state_change -- changed to writable" );
|
||||
} else if( state == UTP_STATE_EOF ) {
|
||||
|
|
|
@ -71,6 +71,7 @@ typedef struct tr_peerIo
|
|||
tr_bool extendedProtocolSupported;
|
||||
tr_bool fastExtensionSupported;
|
||||
tr_bool dhtSupported;
|
||||
tr_bool utpSupported;
|
||||
|
||||
tr_priority_t priority;
|
||||
|
||||
|
@ -177,6 +178,11 @@ static inline tr_bool tr_peerIoSupportsDHT( const tr_peerIo * io )
|
|||
return io->dhtSupported;
|
||||
}
|
||||
|
||||
static inline tr_bool tr_peerIoSupportsUTP( const tr_peerIo * io )
|
||||
{
|
||||
return io->dhtSupported;
|
||||
}
|
||||
|
||||
/**
|
||||
***
|
||||
**/
|
||||
|
|
|
@ -671,6 +671,16 @@ tr_peerMgrPeerIsSeed( const tr_torrent * tor,
|
|||
return isSeed;
|
||||
}
|
||||
|
||||
void
|
||||
tr_peerMgrSetUtpSupported( tr_torrent * tor, const tr_address * addr )
|
||||
{
|
||||
struct peer_atom * atom = getExistingAtom( tor->torrentPeers, addr );
|
||||
|
||||
if( atom )
|
||||
atom->flags |= ADDED_F_UTP_FLAGS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*** REQUESTS
|
||||
***
|
||||
|
|
|
@ -149,6 +149,9 @@ void tr_peerMgrFree( tr_peerMgr * manager );
|
|||
tr_bool tr_peerMgrPeerIsSeed( const tr_torrent * tor,
|
||||
const tr_address * addr );
|
||||
|
||||
void tr_peerMgrSetUtpSupported( tr_torrent * tor,
|
||||
const tr_address * addr );
|
||||
|
||||
void tr_peerMgrGetNextRequests( tr_torrent * torrent,
|
||||
tr_peer * peer,
|
||||
int numwant,
|
||||
|
|
|
@ -2376,6 +2376,11 @@ tr_peerMsgsNew( struct tr_torrent * torrent,
|
|||
peer->msgs = m;
|
||||
tr_timerAdd( m->pexTimer, PEX_INTERVAL_SECS, 0 );
|
||||
|
||||
if( tr_peerIoSupportsUTP( peer->io ) ) {
|
||||
const tr_address * addr = tr_peerIoGetAddress( peer->io, NULL );
|
||||
tr_peerMgrSetUtpSupported( torrent, addr );
|
||||
}
|
||||
|
||||
if( tr_peerIoSupportsLTEP( peer->io ) )
|
||||
sendLtepHandshake( m );
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue