Ticket #7: prefer-dht.patch

File prefer-dht.patch, 1.4 KB (added by jch, 13 years ago)
  • libtransmission/peer-mgr.c

    diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c
    index 47176f0..5e6f3a6 100644
    a b compareCandidates( const void * va, 
    21402140    if( a->time != b->time )
    21412141        return a->time < b->time ? -1 : 1;
    21422142
    2143     /* all other things being equal, prefer peers whose
    2144      * information comes from a more reliable source */
     2143    /* In order to avoid fragmenting the swarm, peers from trackers and
     2144     * from the DHT should be preferred to peers from PEX. */
    21452145    if( a->from != b->from )
    21462146        return a->from < b->from ? -1 : 1;
    21472147
  • libtransmission/transmission.h

    diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h
    index 94f8c9f..44d060a 100644
    a b enum 
    13351335{
    13361336    TR_PEER_FROM_INCOMING  = 0,  /* connections made to the listening port */
    13371337    TR_PEER_FROM_TRACKER   = 1,  /* peers received from a tracker */
    1338     TR_PEER_FROM_CACHE     = 2,  /* peers read from the peer cache */
    1339     TR_PEER_FROM_PEX       = 3,  /* peers discovered via PEX */
    1340     TR_PEER_FROM_DHT       = 4,  /* peers learnt from the DHT */
     1338    TR_PEER_FROM_DHT       = 2,  /* peers learnt from the DHT */
     1339    TR_PEER_FROM_CACHE     = 3,  /* peers read from the peer cache */
     1340    TR_PEER_FROM_PEX       = 4,  /* peers discovered via PEX */
    13411341    TR_PEER_FROM__MAX
    13421342};
    13431343