Changeset 12590


Ignore:
Timestamp:
Jul 25, 2011, 10:33:07 PM (10 years ago)
Author:
jordan
Message:

(trunk libT) during the extended handshake, don't send the "m" dict if it doesn't have any entries.

File:
1 edited

Legend:

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

    r12555 r12590  
    788788sendLtepHandshake( tr_peermsgs * msgs )
    789789{
    790     tr_benc val, *m;
     790    tr_benc val;
    791791    bool allow_pex;
    792792    bool allow_metadata_xfer;
     
    826826    tr_bencDictAddInt( &val, "upload_only", tr_torrentIsSeed( msgs->torrent ) );
    827827    tr_bencDictAddStr( &val, "v", TR_NAME " " USERAGENT_PREFIX );
    828     m  = tr_bencDictAddDict( &val, "m", 2 );
    829     if( allow_metadata_xfer )
    830         tr_bencDictAddInt( m, "ut_metadata", UT_METADATA_ID );
    831     if( allow_pex )
    832         tr_bencDictAddInt( m, "ut_pex", UT_PEX_ID );
     828    if( allow_metadata_xfer || allow_pex ) {
     829        tr_benc * m  = tr_bencDictAddDict( &val, "m", 2 );
     830        if( allow_metadata_xfer )
     831            tr_bencDictAddInt( m, "ut_metadata", UT_METADATA_ID );
     832        if( allow_pex )
     833            tr_bencDictAddInt( m, "ut_pex", UT_PEX_ID );
     834    }
    833835
    834836    payload = tr_bencToBuf( &val, TR_FMT_BENC );
Note: See TracChangeset for help on using the changeset viewer.