Changeset 10635


Ignore:
Timestamp:
May 8, 2010, 8:42:45 AM (11 years ago)
Author:
charles
Message:

(trunk) #3060 "Local Peer Discovery" -- in the code, rename LDS as LPD for Local Peer Discovery

Location:
trunk
Files:
20 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Transmission.xcodeproj/project.pbxproj

    r10609 r10635  
    105105                A21FBBAB0EDA78C300BC3C51 /* bandwidth.h in Headers */ = {isa = PBXBuildFile; fileRef = A21FBBA90EDA78C300BC3C51 /* bandwidth.h */; };
    106106                A21FBBAC0EDA78C300BC3C51 /* bandwidth.c in Sources */ = {isa = PBXBuildFile; fileRef = A21FBBAA0EDA78C300BC3C51 /* bandwidth.c */; };
    107                 A220EC5B118C8A060022B4BE /* tr-lds.c in Sources */ = {isa = PBXBuildFile; fileRef = A220EC59118C8A060022B4BE /* tr-lds.c */; };
    108                 A220EC5C118C8A060022B4BE /* tr-lds.h in Headers */ = {isa = PBXBuildFile; fileRef = A220EC5A118C8A060022B4BE /* tr-lds.h */; };
     107                A220EC5B118C8A060022B4BE /* tr-lpd.c in Sources */ = {isa = PBXBuildFile; fileRef = A220EC59118C8A060022B4BE /* tr-lpd.c */; };
     108                A220EC5C118C8A060022B4BE /* tr-lpd.h in Headers */ = {isa = PBXBuildFile; fileRef = A220EC5A118C8A060022B4BE /* tr-lpd.h */; };
    109109                A22180980D148A71007D09ED /* GroupsPrefsController.m in Sources */ = {isa = PBXBuildFile; fileRef = A22180970D148A71007D09ED /* GroupsPrefsController.m */; };
    110110                A221DCC8104B3660008A642D /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A221DCC7104B3660008A642D /* Quartz.framework */; };
     
    547547                A21FBBA90EDA78C300BC3C51 /* bandwidth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bandwidth.h; path = libtransmission/bandwidth.h; sourceTree = "<group>"; };
    548548                A21FBBAA0EDA78C300BC3C51 /* bandwidth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bandwidth.c; path = libtransmission/bandwidth.c; sourceTree = "<group>"; };
    549                 A220EC59118C8A060022B4BE /* tr-lds.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tr-lds.c"; path = "libtransmission/tr-lds.c"; sourceTree = "<group>"; };
    550                 A220EC5A118C8A060022B4BE /* tr-lds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "tr-lds.h"; path = "libtransmission/tr-lds.h"; sourceTree = "<group>"; };
     549                A220EC59118C8A060022B4BE /* tr-lpd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tr-lpd.c"; path = "libtransmission/tr-lpd.c"; sourceTree = "<group>"; };
     550                A220EC5A118C8A060022B4BE /* tr-lpd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "tr-lpd.h"; path = "libtransmission/tr-lpd.h"; sourceTree = "<group>"; };
    551551                A22180960D148A71007D09ED /* GroupsPrefsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GroupsPrefsController.h; path = macosx/GroupsPrefsController.h; sourceTree = "<group>"; };
    552552                A22180970D148A71007D09ED /* GroupsPrefsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GroupsPrefsController.m; path = macosx/GroupsPrefsController.m; sourceTree = "<group>"; };
     
    12131213                                A22CFCA60FC24ED80009BD3E /* tr-dht.c */,
    12141214                                A22CFCA70FC24ED80009BD3E /* tr-dht.h */,
    1215                                 A220EC59118C8A060022B4BE /* tr-lds.c */,
    1216                                 A220EC5A118C8A060022B4BE /* tr-lds.h */,
     1215                                A220EC59118C8A060022B4BE /* tr-lpd.c */,
     1216                                A220EC5A118C8A060022B4BE /* tr-lpd.h */,
    12171217                                A2AAB65B0DE0CF6200E04DDA /* rpcimpl.c */,
    12181218                                A2AAB6590DE0CF6200E04DDA /* rpcimpl.h */,
     
    15701570                                A209EE5D1144B51E002B02D1 /* history.h in Headers */,
    15711571                                A247A443114C701800547DFC /* InfoViewController.h in Headers */,
    1572                                 A220EC5C118C8A060022B4BE /* tr-lds.h in Headers */,
     1572                                A220EC5C118C8A060022B4BE /* tr-lpd.h in Headers */,
    15731573                        );
    15741574                        runOnlyForDeploymentPostprocessing = 0;
     
    20412041                                4D80185910BBC0B0008A4AF2 /* magnet.c in Sources */,
    20422042                                A209EE5C1144B51E002B02D1 /* history.c in Sources */,
    2043                                 A220EC5B118C8A060022B4BE /* tr-lds.c in Sources */,
     2043                                A220EC5B118C8A060022B4BE /* tr-lpd.c in Sources */,
    20442044                        );
    20452045                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/daemon/daemon.c

    r10606 r10635  
    8686    { 'o', "dht", "Enable distributed hash tables (DHT)", "o", 0, NULL },
    8787    { 'O', "no-dht", "Disable distributed hash tables (DHT)", "O", 0, NULL },
    88     { 'z', "lds", "Enable local peer discovery (LDS)", "z", 0, NULL },
    89     { 'Z', "no-lds", "Disable local peer discovery (LDS)", "Z", 0, NULL },
     88    { 'z', "lds", "Enable local peer discovery (LPD)", "z", 0, NULL },
     89    { 'Z', "no-lds", "Disable local peer discovery (LPD)", "Z", 0, NULL },
    9090    { 'P', "peerport", "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "P", 1, "<port>" },
    9191    { 'm', "portmap", "Enable portmapping via NAT-PMP or UPnP", "m", 0, NULL },
     
    409409                      tr_bencDictAddBool( &settings, TR_PREFS_KEY_RATIO_ENABLED, FALSE );
    410410                      break;
    411             case 'z': tr_bencDictAddBool( &settings, TR_PREFS_KEY_LDS_ENABLED, TRUE );
    412                       break;
    413             case 'Z': tr_bencDictAddBool( &settings, TR_PREFS_KEY_LDS_ENABLED, FALSE );
     411            case 'z': tr_bencDictAddBool( &settings, TR_PREFS_KEY_LPD_ENABLED, TRUE );
     412                      break;
     413            case 'Z': tr_bencDictAddBool( &settings, TR_PREFS_KEY_LPD_ENABLED, FALSE );
    414414                      break;
    415415            default:  showUsage( );
  • trunk/daemon/remote.c

    r10626 r10635  
    256256    { 'x', "pex",                   "Enable peer exchange (PEX)", "x",  0, NULL },
    257257    { 'X', "no-pex",                "Disable peer exchange (PEX)", "X",  0, NULL },
    258     { 'z', "lds",                   "Enable local peer discovery (LDS)", "z",  0, NULL },
    259     { 'Z', "no-lds",                "Disable local peer discovery (LDS)", "Z",  0, NULL },
     258    { 'z', "lds",                   "Enable local peer discovery (LPD)", "z",  0, NULL },
     259    { 'Z', "no-lds",                "Disable local peer discovery (LPD)", "Z",  0, NULL },
    260260    { 940, "peer-info",             "List the current torrent(s)' peers", "pi",  0, NULL },
    261261    {   0, NULL,                    NULL, NULL, 0, NULL }
     
    13441344        if( tr_bencDictFindBool( args, TR_PREFS_KEY_DHT_ENABLED, &boolVal ) )
    13451345            printf( "  Distributed hash table enabled: %s\n", ( boolVal ? "Yes" : "No" ) );
    1346         if( tr_bencDictFindBool( args, TR_PREFS_KEY_LDS_ENABLED, &boolVal ) )
     1346        if( tr_bencDictFindBool( args, TR_PREFS_KEY_LPD_ENABLED, &boolVal ) )
    13471347            printf( "  Local peer discovery enabled: %s\n", ( boolVal ? "Yes" : "No" ) );
    13481348        if( tr_bencDictFindBool( args, TR_PREFS_KEY_PEX_ENABLED, &boolVal ) )
     
    18241824                case 'X': tr_bencDictAddBool( args, TR_PREFS_KEY_PEX_ENABLED, FALSE );
    18251825                          break;
    1826                 case 'z': tr_bencDictAddBool( args, TR_PREFS_KEY_LDS_ENABLED, TRUE );
    1827                           break;
    1828                 case 'Z': tr_bencDictAddBool( args, TR_PREFS_KEY_LDS_ENABLED, FALSE );
     1826                case 'z': tr_bencDictAddBool( args, TR_PREFS_KEY_LPD_ENABLED, TRUE );
     1827                          break;
     1828                case 'Z': tr_bencDictAddBool( args, TR_PREFS_KEY_LPD_ENABLED, FALSE );
    18291829                          break;
    18301830                case 953: tr_bencDictAddReal( args, "seedRatioLimit", atof(optarg) );
  • trunk/daemon/transmission-remote.1

    r10611 r10635  
    249249Disable peer exchange (PEX).
    250250.It Fl z Fl -lds
    251 Enable local peer discovery (LDS).
     251Enable local peer discovery (LPD).
    252252.It Fl Z Fl -no-lds
    253 Disable local peer discovery (LDS).
     253Disable local peer discovery (LPD).
    254254.It Fl pi Fl -peer-info
    255255List the current torrent's connected peers.
  • trunk/doc/rpc-spec.txt

    r10608 r10635  
    406406   "incomplete-dir"              | string     path for incomplete torrents, when enabled
    407407   "incomplete-dir-enabled"      | boolean    true means keep torrents in incomplete-dir until done
    408    "lds-enabled"                 | boolean    true means allow lds in public torrents
     408   "lpd-enabled"                 | boolean    true means allow Local Peer Discovery in public torrents
    409409   "peer-limit-global"           | number     maximum global number of peers
    410410   "peer-limit-per-torrent"      | number     maximum global number of peers
  • trunk/gtk/main.c

    r10611 r10635  
    12221222        tr_sessionSetDHTEnabled( tr, pref_flag_get( key ) );
    12231223    }
    1224     else if( !strcmp( key, TR_PREFS_KEY_LDS_ENABLED ) )
    1225     {
    1226         tr_sessionSetLDSEnabled( tr, pref_flag_get( key ) );
     1224    else if( !strcmp( key, TR_PREFS_KEY_LPD_ENABLED ) )
     1225    {
     1226        tr_sessionSetLPDEnabled( tr, pref_flag_get( key ) );
    12271227    }
    12281228    else if( !strcmp( key, TR_PREFS_KEY_RPC_PORT ) )
  • trunk/gtk/tr-prefs.c

    r10611 r10635  
    555555    hig_workarea_add_wide_control( t, &row, w );
    556556
    557     s = _( "Use LDS to find local peers" );
    558     w = new_check_button( s, TR_PREFS_KEY_LDS_ENABLED, core );
    559     s = _( "LDS is a tool for finding peers on your local network." );
     557    s = _( "Use Local Peer Discovery to find more peers" );
     558    w = new_check_button( s, TR_PREFS_KEY_LPD_ENABLED, core );
     559    s = _( "LPD is a tool for finding peers on your local network." );
    560560    gtr_widget_set_tooltip_text( w, s );
    561561    hig_workarea_add_wide_control( t, &row, w );
  • trunk/libtransmission/Makefile.am

    r10606 r10635  
    5656    torrent-magnet.c \
    5757    tr-dht.c \
    58     tr-lds.c \
     58    tr-lpd.c \
    5959    tr-getopt.c \
    6060    trevent.c \
     
    109109    transmission.h \
    110110    tr-dht.h \
    111     tr-lds.h \
     111    tr-lpd.h \
    112112    trevent.h \
    113113    upnp.h \
  • trunk/libtransmission/announcer.c

    r10606 r10635  
    2525#include "session.h"
    2626#include "tr-dht.h"
    27 #include "tr-lds.h"
     27#include "tr-lpd.h"
    2828#include "torrent.h"
    2929#include "utils.h"
     
    7070
    7171    /* this is an upper limit for the frequency of LDS announces */
    72     LDS_HOUSEKEEPING_INTERVAL_SECS = 30
     72    LPD_HOUSEKEEPING_INTERVAL_SECS = 30
    7373
    7474};
     
    207207    struct event * upkeepTimer;
    208208    int slotsAvailable;
    209     time_t ldsHouseKeepingAt;
     209    time_t lpdHouseKeepingAt;
    210210}
    211211tr_announcer;
     
    255255
    256256    const time_t relaxUntil =
    257         calcRescheduleWithJitter( LDS_HOUSEKEEPING_INTERVAL_SECS / 3 );
     257        calcRescheduleWithJitter( LPD_HOUSEKEEPING_INTERVAL_SECS / 3 );
    258258
    259259    assert( tr_isSession( session ) );
     
    264264    a->session = session;
    265265    a->slotsAvailable = MAX_CONCURRENT_TASKS;
    266     a->ldsHouseKeepingAt = relaxUntil;
     266    a->lpdHouseKeepingAt = relaxUntil;
    267267    a->upkeepTimer = tr_new0( struct event, 1 );
    268268    evtimer_set( a->upkeepTimer, onUpkeepTimer, a );
     
    19081908
    19091909    /* Local Peer Discovery */
    1910     if( announcer->ldsHouseKeepingAt <= now )
    1911     {
    1912         tr_ldsAnnounceMore( now, LDS_HOUSEKEEPING_INTERVAL_SECS );
     1910    if( announcer->lpdHouseKeepingAt <= now )
     1911    {
     1912        tr_lpdAnnounceMore( now, LPD_HOUSEKEEPING_INTERVAL_SECS );
    19131913
    19141914        /* reschedule more LDS announces for ( the future + jitter ) */
    1915         announcer->ldsHouseKeepingAt =
    1916             calcRescheduleWithJitter( LDS_HOUSEKEEPING_INTERVAL_SECS );
     1915        announcer->lpdHouseKeepingAt =
     1916            calcRescheduleWithJitter( LPD_HOUSEKEEPING_INTERVAL_SECS );
    19171917    }
    19181918}
  • trunk/libtransmission/peer-mgr.c

    r10606 r10635  
    15091509        case TR_PEER_FROM_PEX      : return 60 * 60 * 2;
    15101510        case TR_PEER_FROM_RESUME   : return 60 * 60;
    1511         case TR_PEER_FROM_LDS      : return 10 * 60;
     1511        case TR_PEER_FROM_LPD      : return 10 * 60;
    15121512        default                    : return 60 * 60;
    15131513    }
  • trunk/libtransmission/rpcimpl.c

    r10606 r10635  
    12151215    if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_DHT_ENABLED, &boolVal ) )
    12161216        tr_sessionSetDHTEnabled( session, boolVal );
    1217     if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_LDS_ENABLED, &boolVal ) )
    1218         tr_sessionSetLDSEnabled( session, boolVal );
     1217    if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_LPD_ENABLED, &boolVal ) )
     1218        tr_sessionSetLPDEnabled( session, boolVal );
    12191219    if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_PEER_PORT_RANDOM_ON_START, &boolVal ) )
    12201220        tr_sessionSetPeerPortRandomOnStart( session, boolVal );
     
    13291329    tr_bencDictAddBool( d, TR_PREFS_KEY_PEX_ENABLED, tr_sessionIsPexEnabled( s ) );
    13301330    tr_bencDictAddBool( d, TR_PREFS_KEY_DHT_ENABLED, tr_sessionIsDHTEnabled( s ) );
    1331     tr_bencDictAddBool( d, TR_PREFS_KEY_LDS_ENABLED, tr_sessionIsLDSEnabled( s ) );
     1331    tr_bencDictAddBool( d, TR_PREFS_KEY_LPD_ENABLED, tr_sessionIsLPDEnabled( s ) );
    13321332    tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_PORT, tr_sessionGetPeerPort( s ) );
    13331333    tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_PORT_RANDOM_ON_START, tr_sessionGetPeerPortRandomOnStart( s ) );
  • trunk/libtransmission/session.c

    r10606 r10635  
    4343#include "torrent.h"
    4444#include "tr-dht.h"
    45 #include "tr-lds.h"
     45#include "tr-lpd.h"
    4646#include "trevent.h"
    4747#include "utils.h"
     
    246246    tr_bencDictAddBool( d, TR_PREFS_KEY_BLOCKLIST_ENABLED,        FALSE );
    247247    tr_bencDictAddBool( d, TR_PREFS_KEY_DHT_ENABLED,              TRUE );
    248     tr_bencDictAddBool( d, TR_PREFS_KEY_LDS_ENABLED,              FALSE );
     248    tr_bencDictAddBool( d, TR_PREFS_KEY_LPD_ENABLED,              FALSE );
    249249    tr_bencDictAddStr ( d, TR_PREFS_KEY_DOWNLOAD_DIR,             tr_getDefaultDownloadDir( ) );
    250250    tr_bencDictAddInt ( d, TR_PREFS_KEY_DSPEED,                   100 );
     
    309309    tr_bencDictAddBool( d, TR_PREFS_KEY_BLOCKLIST_ENABLED,        tr_blocklistIsEnabled( s ) );
    310310    tr_bencDictAddBool( d, TR_PREFS_KEY_DHT_ENABLED,              s->isDHTEnabled );
    311     tr_bencDictAddBool( d, TR_PREFS_KEY_LDS_ENABLED,              s->isLDSEnabled );
     311    tr_bencDictAddBool( d, TR_PREFS_KEY_LPD_ENABLED,              s->isLPDEnabled );
    312312    tr_bencDictAddStr ( d, TR_PREFS_KEY_DOWNLOAD_DIR,             s->downloadDir );
    313313    tr_bencDictAddInt ( d, TR_PREFS_KEY_DSPEED,                   tr_sessionGetSpeedLimit( s, TR_DOWN ) );
     
    629629    }
    630630
    631     if( session->isLDSEnabled )
    632     {
    633         if( tr_ldsInit( session, &session->public_ipv4->addr ) )
    634             tr_ninf( "LDS", "Local Peer Discovery active" );
    635     }
    636     else
    637         tr_ndbg( "LDS", "Local Peer Discovery disabled" );
     631    if( !session->isLPDEnabled )
     632        tr_ndbg( "LPD", _( "Local Peer Discovery disabled" ) );
     633    else if( tr_lpdInit( session, &session->public_ipv4->addr ) )
     634        tr_ninf( "LPD", _( "Local Peer Discovery active" ) );
    638635
    639636    /* cleanup */
     
    679676    if( tr_bencDictFindBool( settings, TR_PREFS_KEY_DHT_ENABLED, &boolVal ) )
    680677        tr_sessionSetDHTEnabled( session, boolVal );
    681     if( tr_bencDictFindBool( settings, TR_PREFS_KEY_LDS_ENABLED, &boolVal ) )
    682         tr_sessionSetLDSEnabled( session, boolVal );
     678    if( tr_bencDictFindBool( settings, TR_PREFS_KEY_LPD_ENABLED, &boolVal ) )
     679        tr_sessionSetLPDEnabled( session, boolVal );
    683680    if( tr_bencDictFindInt( settings, TR_PREFS_KEY_ENCRYPTION, &i ) )
    684681        tr_sessionSetEncryption( session, i );
     
    15651562    free_incoming_peer_port( session );
    15661563
    1567     if( session->isLDSEnabled )
    1568         tr_ldsUninit( session );
     1564    if( session->isLPDEnabled )
     1565        tr_lpdUninit( session );
    15691566
    15701567    if( session->isDHTEnabled )
     
    18031800
    18041801void
    1805 tr_sessionSetLDSEnabled( tr_session * session,
     1802tr_sessionSetLPDEnabled( tr_session * session,
    18061803                         tr_bool      enabled )
    18071804{
    18081805    assert( tr_isSession( session ) );
    18091806
    1810     session->isLDSEnabled = ( enabled != 0 );
    1811 }
    1812 
    1813 tr_bool
    1814 tr_sessionIsLDSEnabled( const tr_session * session )
    1815 {
    1816     assert( tr_isSession( session ) );
    1817 
    1818     return session->isLDSEnabled;
    1819 }
    1820 
    1821 tr_bool
    1822 tr_sessionAllowsLDS( const tr_session * session )
    1823 {
    1824     return tr_sessionIsLDSEnabled( session );
     1807    session->isLPDEnabled = ( enabled != 0 );
     1808}
     1809
     1810tr_bool
     1811tr_sessionIsLPDEnabled( const tr_session * session )
     1812{
     1813    assert( tr_isSession( session ) );
     1814
     1815    return session->isLPDEnabled;
     1816}
     1817
     1818tr_bool
     1819tr_sessionAllowsLPD( const tr_session * session )
     1820{
     1821    return tr_sessionIsLPDEnabled( session );
    18251822}
    18261823
  • trunk/libtransmission/session.h

    r10606 r10635  
    8585    tr_bool                      isPexEnabled;
    8686    tr_bool                      isDHTEnabled;
    87     tr_bool                      isLDSEnabled;
     87    tr_bool                      isLPDEnabled;
    8888    tr_bool                      isBlocklistEnabled;
    8989    tr_bool                      isProxyEnabled;
     
    181181tr_bool      tr_sessionAllowsDHT( const tr_session * session );
    182182
    183 tr_bool      tr_sessionAllowsLDS( const tr_session * session );
     183tr_bool      tr_sessionAllowsLPD( const tr_session * session );
    184184
    185185const char * tr_sessionFindTorrentFile( const tr_session * session,
  • trunk/libtransmission/torrent.c

    r10606 r10635  
    14011401        tor->dhtAnnounceAt = now + tr_cryptoWeakRandInt( 20 );
    14021402        tor->dhtAnnounce6At = now + tr_cryptoWeakRandInt( 20 );
    1403         tor->ldsAnnounceAt = now;
     1403        tor->lpdAnnounceAt = now;
    14041404        tr_peerMgrStartTorrent( tor );
    14051405    }
  • trunk/libtransmission/torrent.h

    r10606 r10635  
    201201    tr_bool                    dhtAnnounce6InProgress;
    202202   
    203     time_t                     ldsAnnounceAt;
     203    time_t                     lpdAnnounceAt;
    204204
    205205    uint64_t                   downloadedCur;
     
    335335}
    336336
    337 static inline tr_bool tr_torrentAllowsLDS( const tr_torrent * tor )
     337static inline tr_bool tr_torrentAllowsLPD( const tr_torrent * tor )
    338338{
    339339    return ( tor != NULL )
    340         && ( tr_sessionAllowsLDS( tor->session ) )
     340        && ( tr_sessionAllowsLPD( tor->session ) )
    341341        && ( !tr_torrentIsPrivate( tor ) );
    342342}
  • trunk/libtransmission/tr-lpd.c

    r10634 r10635  
    4545#include "session.h"
    4646#include "torrent.h" /* tr_torrentFindFromHash() */
    47 #include "tr-lds.h"
     47#include "tr-lpd.h"
    4848#include "utils.h"
    4949#include "version.h"
     
    5151/**
    5252* @brief Local Peer Discovery
    53 * @file tr-lds.c
    54 *
    55 * This module implements the Local Peer Discovery (LDS) protocol as supported by the
    56 * uTorrent client application.  A typical LDS datagram is 119 bytes long.
     53* @file tr-lpd.c
     54*
     55* This module implements the Local Peer Discovery (LPD) protocol as supported by the
     56* uTorrent client application.  A typical LPD datagram is 119 bytes long.
    5757*
    5858* $Id$
     
    6161static void event_callback( int, short, void* );
    6262
    63 static int lds_socket; /**<separate multicast receive socket */
    64 static int lds_socket2; /**<and multicast send socket */
    65 static struct event lds_event;
    66 static tr_port lds_port;
    67 
    68 static tr_torrent* lds_torStaticType UNUSED; /* just a helper for static type analysis */
     63static int lpd_socket; /**<separate multicast receive socket */
     64static int lpd_socket2; /**<and multicast send socket */
     65static struct event lpd_event;
     66static tr_port lpd_port;
     67
     68static tr_torrent* lpd_torStaticType UNUSED; /* just a helper for static type analysis */
    6969static tr_session* session;
    7070
    71 enum { lds_maxDatagramLength = 200 }; /**<the size an LDS datagram must not exceed */
    72 const char lds_mcastGroup[] = "239.192.152.143"; /**<LDS multicast group */
    73 const int lds_mcastPort = 6771; /**<LDS source and destination UPD port */
    74 static struct sockaddr_in lds_mcastAddr; /**<initialized from the above constants in tr_ldsInit */
     71enum { lpd_maxDatagramLength = 200 }; /**<the size an LPD datagram must not exceed */
     72const char lpd_mcastGroup[] = "239.192.152.143"; /**<LPD multicast group */
     73const int lpd_mcastPort = 6771; /**<LPD source and destination UPD port */
     74static struct sockaddr_in lpd_mcastAddr; /**<initialized from the above constants in tr_lpdInit */
    7575
    7676/**
    7777* @brief Protocol-related information carried by a Local Peer Discovery packet */
    78 struct lds_protocolVersion
     78struct lpd_protocolVersion
    7979{
    8080    int major, minor;
    8181};
    8282
    83 enum lds_enumTimeToLive {
    84     lds_ttlSameSubnet = 1,
    85     lds_ttlSameSite = 32,
    86     lds_ttlSameRegion = 64,
    87     lds_ttlSameContinent = 128,
    88     lds_ttlUnrestricted = 255
     83enum lpd_enumTimeToLive {
     84    lpd_ttlSameSubnet = 1,
     85    lpd_ttlSameSite = 32,
     86    lpd_ttlSameRegion = 64,
     87    lpd_ttlSameContinent = 128,
     88    lpd_ttlUnrestricted = 255
    8989};
    9090
    9191enum {
    92     lds_announceInterval = 4 * 60, /**<4 min announce interval per torrent */
    93     lds_announceScope = lds_ttlSameSubnet /**<the maximum scope for LDS datagrams */
     92    lpd_announceInterval = 4 * 60, /**<4 min announce interval per torrent */
     93    lpd_announceScope = lpd_ttlSameSubnet /**<the maximum scope for LPD datagrams */
    9494};
    9595
     
    113113* @brief allow at most ten messages per second (interval average)
    114114* @note this constraint is only enforced once per housekeeping interval */
    115 enum { lds_announceCapFactor = 10 };
     115enum { lpd_announceCapFactor = 10 };
    116116
    117117/**
     
    119119* @brief number of unsolicited messages during the last HK interval
    120120* @remark counts downwards */
    121 static int lds_unsolicitedMsgCounter;
     121static int lpd_unsolicitedMsgCounter;
    122122
    123123/**
    124124* @def CRLF
    125 * @brief a line-feed, as understood by the LDS protocol */
     125* @brief a line-feed, as understood by the LPD protocol */
    126126#define CRLF "\r\n"
    127127
     
    145145* in this case the function returns a character sequence beginning with CRLF).
    146146* If parameter is not NULL, the declared protocol version is returned as part of
    147 * the lds_protocolVersion structure.
    148 */
    149 static const char* lds_extractHeader( const char* s, struct lds_protocolVersion* const ver )
     147* the lpd_protocolVersion structure.
     148*/
     149static const char* lpd_extractHeader( const char* s, struct lpd_protocolVersion* const ver )
    150150{
    151151    int major = -1, minor = -1;
     
    156156
    157157    /* something might be rotten with this chunk of data */
    158     if( len == 0 || len > lds_maxDatagramLength )
     158    if( len == 0 || len > lpd_maxDatagramLength )
    159159        return NULL;
    160160
     
    199199*   - copy back value from end to next "\r\n"
    200200*/
    201 static int lds_extractParam( const char* const str, const char* const name, int n, char* const val )
     201static int lpd_extractParam( const char* const str, const char* const name, int n, char* const val )
    202202{
    203203    /* configure maximum length of search string here */
     
    245245/**
    246246* @brief Configures additional capabilities for a socket */
    247 static inline int lds_configureSocket( int sock, int add )
     247static inline int lpd_configureSocket( int sock, int add )
    248248{
    249249    /* read-modify-write socket flags */
     
    265265* and event-based message handling.
    266266*
    267 * @remark Since the LDS service does not use another protocol family yet, this code is
     267* @remark Since the LPD service does not use another protocol family yet, this code is
    268268* IPv4 only for the time being.
    269269*/
    270 int tr_ldsInit( tr_session* ss, tr_address* tr_addr UNUSED )
     270int tr_lpdInit( tr_session* ss, tr_address* tr_addr UNUSED )
    271271{
    272272    struct ip_mreq mcastReq;
     
    276276        return -1;
    277277
    278     assert( lds_announceInterval > 0 );
    279     assert( lds_announceScope > 0 );
    280 
    281     lds_port = tr_sessionGetPeerPort( ss );
    282     if( lds_port <= 0 )
     278    assert( lpd_announceInterval > 0 );
     279    assert( lpd_announceScope > 0 );
     280
     281    lpd_port = tr_sessionGetPeerPort( ss );
     282    if( lpd_port <= 0 )
    283283        return -1;
    284284
    285     tr_ndbg( "LDS", "Initialising Local Peer Discovery" );
     285    tr_ndbg( "LPD", "Initialising Local Peer Discovery" );
    286286
    287287    /* setup datagram socket (receive) */
    288288    {
    289         lds_socket = socket( PF_INET, SOCK_DGRAM, 0 );
    290         if( lds_socket < 0 )
     289        lpd_socket = socket( PF_INET, SOCK_DGRAM, 0 );
     290        if( lpd_socket < 0 )
    291291            goto fail;
    292292
    293293        /* enable non-blocking operation */
    294         if( lds_configureSocket( lds_socket, O_NONBLOCK ) < 0 )
    295             goto fail;
    296 
    297         if( setsockopt( lds_socket, SOL_SOCKET, SO_REUSEADDR,
     294        if( lpd_configureSocket( lpd_socket, O_NONBLOCK ) < 0 )
     295            goto fail;
     296
     297        if( setsockopt( lpd_socket, SOL_SOCKET, SO_REUSEADDR,
    298298                &opt_on, sizeof opt_on ) < 0 )
    299299            goto fail;
    300300
    301         memset( &lds_mcastAddr, 0, sizeof lds_mcastAddr );
    302         lds_mcastAddr.sin_family = AF_INET;
    303         lds_mcastAddr.sin_port = htons( lds_mcastPort );
    304         if( inet_pton( lds_mcastAddr.sin_family, lds_mcastGroup,
    305                 &lds_mcastAddr.sin_addr ) < 0 )
    306             goto fail;
    307 
    308         if( bind( lds_socket, (struct sockaddr*) &lds_mcastAddr,
    309                 sizeof lds_mcastAddr ) < 0 )
    310             goto fail;
    311 
    312         /* we want to join that LDS multicast group */
     301        memset( &lpd_mcastAddr, 0, sizeof lpd_mcastAddr );
     302        lpd_mcastAddr.sin_family = AF_INET;
     303        lpd_mcastAddr.sin_port = htons( lpd_mcastPort );
     304        if( inet_pton( lpd_mcastAddr.sin_family, lpd_mcastGroup,
     305                &lpd_mcastAddr.sin_addr ) < 0 )
     306            goto fail;
     307
     308        if( bind( lpd_socket, (struct sockaddr*) &lpd_mcastAddr,
     309                sizeof lpd_mcastAddr ) < 0 )
     310            goto fail;
     311
     312        /* we want to join that LPD multicast group */
    313313        memset( &mcastReq, 0, sizeof mcastReq );
    314         mcastReq.imr_multiaddr = lds_mcastAddr.sin_addr;
     314        mcastReq.imr_multiaddr = lpd_mcastAddr.sin_addr;
    315315        mcastReq.imr_interface.s_addr = htonl( INADDR_ANY );
    316         if( setsockopt( lds_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP,
     316        if( setsockopt( lpd_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP,
    317317                &mcastReq, sizeof mcastReq ) < 0 )
    318318            goto fail;
    319319
    320         if( setsockopt( lds_socket, IPPROTO_IP, IP_MULTICAST_LOOP,
     320        if( setsockopt( lpd_socket, IPPROTO_IP, IP_MULTICAST_LOOP,
    321321                &opt_off, sizeof opt_off ) < 0 )
    322322            goto fail;
     
    325325    /* setup datagram socket (send) */
    326326    {
    327         const unsigned char scope = lds_announceScope;
    328 
    329         lds_socket2 = socket( PF_INET, SOCK_DGRAM, 0 );
    330         if( lds_socket2 < 0 )
     327        const unsigned char scope = lpd_announceScope;
     328
     329        lpd_socket2 = socket( PF_INET, SOCK_DGRAM, 0 );
     330        if( lpd_socket2 < 0 )
    331331            goto fail;
    332332
    333333        /* enable non-blocking operation */
    334         if( lds_configureSocket( lds_socket2, O_NONBLOCK ) < 0 )
     334        if( lpd_configureSocket( lpd_socket2, O_NONBLOCK ) < 0 )
    335335            goto fail;
    336336
    337337        /* configure outbound multicast TTL */
    338         if( setsockopt( lds_socket2, IPPROTO_IP, IP_MULTICAST_TTL,
     338        if( setsockopt( lpd_socket2, IPPROTO_IP, IP_MULTICAST_TTL,
    339339                &scope, sizeof scope ) < 0 )
    340340            goto fail;
    341341
    342         if( setsockopt( lds_socket2, IPPROTO_IP, IP_MULTICAST_LOOP,
     342        if( setsockopt( lpd_socket2, IPPROTO_IP, IP_MULTICAST_LOOP,
    343343                &opt_off, sizeof opt_off ) < 0 )
    344344            goto fail;
     
    347347    session = ss;
    348348
    349     /* Note: lds_unsolicitedMsgCounter remains 0 until the first timeout event, thus
     349    /* Note: lpd_unsolicitedMsgCounter remains 0 until the first timeout event, thus
    350350     * any announcement received during the initial interval will be discarded. */
    351351
    352     event_set( &lds_event, lds_socket, EV_READ | EV_PERSIST, event_callback, NULL );
    353     event_add( &lds_event, NULL );
    354 
    355     tr_ndbg( "LDS", "Local Peer Discovery initialised" );
     352    event_set( &lpd_event, lpd_socket, EV_READ | EV_PERSIST, event_callback, NULL );
     353    event_add( &lpd_event, NULL );
     354
     355    tr_ndbg( "LPD", "Local Peer Discovery initialised" );
    356356
    357357    return 1;
     
    360360    {
    361361        const int save = errno;
    362         close( lds_socket );
    363         close( lds_socket2 );
    364         lds_socket = lds_socket2 = -1;
     362        close( lpd_socket );
     363        close( lpd_socket2 );
     364        lpd_socket = lpd_socket2 = -1;
    365365        session = NULL;
    366         tr_ndbg( "LDS", "LDS initialisation failed (errno = %d)", save );
     366        tr_ndbg( "LPD", "LPD initialisation failed (errno = %d)", save );
    367367        errno = save;
    368368    }
     
    372372}
    373373
    374 void tr_ldsUninit( tr_session* ss )
     374void tr_lpdUninit( tr_session* ss )
    375375{
    376376    if( session != ss )
    377377        return;
    378378
    379     tr_ndbg( "LDS", "Uninitialising Local Peer Discovery" );
    380 
    381     event_del( &lds_event );
     379    tr_ndbg( "LPD", "Uninitialising Local Peer Discovery" );
     380
     381    event_del( &lpd_event );
    382382
    383383    /* just shut down, we won't remember any former nodes */
    384     EVUTIL_CLOSESOCKET( lds_socket );
    385     EVUTIL_CLOSESOCKET( lds_socket2 );
    386     tr_ndbg( "LDS", "Done uninitialising Local Peer Discovery" );
     384    EVUTIL_CLOSESOCKET( lpd_socket );
     385    EVUTIL_CLOSESOCKET( lpd_socket2 );
     386    tr_ndbg( "LPD", "Done uninitialising Local Peer Discovery" );
    387387
    388388    session = NULL;
    389389}
    390390
    391 tr_bool tr_ldsEnabled( const tr_session* ss )
     391tr_bool tr_lpdEnabled( const tr_session* ss )
    392392{
    393393    return ss && ( ss == session );
     
    399399* @brief Performs some (internal) software consistency checks at compile time.
    400400* @remark Declared inline for the compiler not to allege us of feeding unused
    401 * functions. In any other respect, lds_consistencyCheck is an orphaned function.
    402 */
    403 static inline void lds_consistencyCheck( void )
     401* functions. In any other respect, lpd_consistencyCheck is an orphaned function.
     402*/
     403static inline void lpd_consistencyCheck( void )
    404404{
    405405    /* if the following check fails, the definition of a hash string has changed
    406      * without our knowledge; revise string handling in functions tr_ldsSendAnnounce
    407      * and tr_ldsConsiderAnnounce. However, the code is designed to function as long
     406     * without our knowledge; revise string handling in functions tr_lpdSendAnnounce
     407     * and tr_lpdConsiderAnnounce. However, the code is designed to function as long
    408408     * as interfaces to the rest of the lib remain compatible with char* strings. */
    409     STATIC_ASSERT( sizeof(lds_torStaticType->info.hashString[0]) == sizeof(char) );
     409    STATIC_ASSERT( sizeof(lpd_torStaticType->info.hashString[0]) == sizeof(char) );
    410410}
    411411/**
     
    414414
    415415/**
    416 * @defgroup LdsProto LDS announcement processing
     416* @defgroup LdsProto LPD announcement processing
    417417* @{
    418418*/
     
    424424* @return Returns TRUE on success
    425425*
    426 * Send a query for torrent t out to the LDS multicast group (or the LAN, for that
     426* Send a query for torrent t out to the LPD multicast group (or the LAN, for that
    427427* matter).  A listening client on the same network might react by adding us to his
    428428* peer pool for torrent t.
    429429*/
    430 tr_bool tr_ldsSendAnnounce( const tr_torrent* t )
     430tr_bool tr_lpdSendAnnounce( const tr_torrent* t )
    431431{
    432432    const char fmt[] =
     
    439439
    440440    char hashString[lengthof( t->info.hashString )];
    441     char query[lds_maxDatagramLength + 1] = { };
     441    char query[lpd_maxDatagramLength + 1] = { };
    442442
    443443    if( t == NULL )
     
    449449
    450450    /* prepare a zero-terminated announce message */
    451     snprintf( query, lds_maxDatagramLength + 1, fmt, 1, 1,
    452         lds_mcastGroup, lds_mcastPort, lds_port, hashString );
    453 
    454     /* actually send the query out using [lds_socket2] */
     451    snprintf( query, lpd_maxDatagramLength + 1, fmt, 1, 1,
     452        lpd_mcastGroup, lpd_mcastPort, lpd_port, hashString );
     453
     454    /* actually send the query out using [lpd_socket2] */
    455455    {
    456456        const int len = strlen( query );
    457457
    458         /* destination address info has already been set up in tr_ldsInit(),
     458        /* destination address info has already been set up in tr_lpdInit(),
    459459         * so we refrain from preparing another sockaddr_in here */
    460         int res = sendto( lds_socket2, query, len, 0,
    461             (const struct sockaddr*) &lds_mcastAddr, sizeof lds_mcastAddr );
     460        int res = sendto( lpd_socket2, query, len, 0,
     461            (const struct sockaddr*) &lpd_mcastAddr, sizeof lpd_mcastAddr );
    462462
    463463        if( res != len )
     
    465465    }
    466466
    467     tr_tordbg( t, "LDS announce message away" );
     467    tr_tordbg( t, "LPD announce message away" );
    468468
    469469    return TRUE;
     
    480480* the peer in/out parameter.
    481481*
    482 * @note The port information gets added to the peer structure if tr_ldsConsiderAnnounce
     482* @note The port information gets added to the peer structure if tr_lpdConsiderAnnounce
    483483* is able to extract the necessary information from the announce message.  That is, if
    484484* return != 0, the caller may retrieve the value from the passed structure.
    485485*/
    486 static int tr_ldsConsiderAnnounce( tr_pex* peer, const char* const msg )
     486static int tr_lpdConsiderAnnounce( tr_pex* peer, const char* const msg )
    487487{
    488488    enum
    489489    {
    490490        maxValueLen = 25,
    491         maxHashLen = lengthof(lds_torStaticType->info.hashString)
     491        maxHashLen = lengthof(lpd_torStaticType->info.hashString)
    492492    };
    493493
    494     struct lds_protocolVersion ver = { -1, -1 };
     494    struct lpd_protocolVersion ver = { -1, -1 };
    495495    char value[maxValueLen] = { };
    496496    char hashString[maxHashLen] = { };
     
    501501        tr_torrent* tor = NULL;
    502502
    503         const char* params = lds_extractHeader( msg, &ver );
     503        const char* params = lpd_extractHeader( msg, &ver );
    504504        if( params == NULL || ver.major != 1 ) /* allow messages of protocol v1 */
    505505            return 0;
     
    507507        /* save the effort to check Host, which seems to be optional anyway */
    508508
    509         if( lds_extractParam( params, "Port", maxValueLen, value ) == 0 )
     509        if( lpd_extractParam( params, "Port", maxValueLen, value ) == 0 )
    510510            return 0;
    511511
     
    517517        res = -1; /* signal caller side-effect to peer->port via return != 0 */
    518518
    519         if( lds_extractParam( params, "Infohash", maxHashLen, hashString ) == 0 )
     519        if( lpd_extractParam( params, "Infohash", maxHashLen, hashString ) == 0 )
    520520            return res;
    521521
    522522        tor = tr_torrentFindFromHashString( session, hashString );
    523523
    524         if( tr_isTorrent( tor ) && tr_torrentAllowsLDS( tor ) )
     524        if( tr_isTorrent( tor ) && tr_torrentAllowsLPD( tor ) )
    525525        {
    526526            /* we found a suitable peer, add it to the torrent */
    527             tr_peerMgrAddPex( tor, TR_PEER_FROM_LDS, peer, -1 );
    528             tr_tordbg( tor, "Learned %d local peer from LDS (%s:%u)",
     527            tr_peerMgrAddPex( tor, TR_PEER_FROM_LPD, peer, -1 );
     528            tr_tordbg( tor, "Learned %d local peer from LPD (%s:%u)",
    529529                1, inet_ntoa( peer->addr.addr.addr4 ), peerPort );
    530530
     
    534534        }
    535535        else
    536             tr_ndbg( "LDS", "Cannot serve torrent #%s", hashString );
     536            tr_ndbg( "LPD", "Cannot serve torrent #%s", hashString );
    537537    }
    538538
     
    544544
    545545/**
    546 * @note Since it possible for tr_ldsAnnounceMore to get called from outside the LDS module,
     546* @note Since it possible for tr_lpdAnnounceMore to get called from outside the LPD module,
    547547* the function needs to be informed of the externally employed housekeeping interval.
    548 * Further, by setting interval to zero (or negative) the caller may actually disable LDS
     548* Further, by setting interval to zero (or negative) the caller may actually disable LPD
    549549* announces on a per-interval basis.
    550550*/
    551 int tr_ldsAnnounceMore( const time_t now, const int interval )
     551int tr_lpdAnnounceMore( const time_t now, const int interval )
    552552{
    553553    tr_torrent* tor = NULL;
     
    558558
    559559    while(( tor = tr_torrentNext( session, tor ) )
    560           && tr_sessionAllowsLDS( session ) )
     560          && tr_sessionAllowsLPD( session ) )
    561561    {
    562562        if( tr_isTorrent( tor ) )
    563563        {
    564             if( !tr_torrentAllowsLDS( tor ) || (
     564            if( !tr_torrentAllowsLPD( tor ) || (
    565565                    ( tr_torrentGetActivity( tor ) != TR_STATUS_DOWNLOAD ) &&
    566566                    ( tr_torrentGetActivity( tor ) != TR_STATUS_SEED ) ) )
    567567                continue;
    568568
    569             if( tor->ldsAnnounceAt <= now )
     569            if( tor->lpdAnnounceAt <= now )
    570570            {
    571                 if( tr_ldsSendAnnounce( tor ) )
     571                if( tr_lpdSendAnnounce( tor ) )
    572572                    announcesSent++;
    573573
    574                 tor->ldsAnnounceAt = now + lds_announceInterval;
     574                tor->lpdAnnounceAt = now + lpd_announceInterval;
    575575                break; /* that's enough; for this interval */
    576576            }
     
    580580    /* perform housekeeping for the flood protection mechanism */
    581581    {
    582         const int maxAnnounceCap = interval * lds_announceCapFactor;
    583 
    584         if( lds_unsolicitedMsgCounter < 0 )
    585             tr_ninf( "LDS", "Dropped %d announces in the last interval (max. %d "
    586                      "allowed)", -lds_unsolicitedMsgCounter, maxAnnounceCap );
    587 
    588         lds_unsolicitedMsgCounter = maxAnnounceCap;
     582        const int maxAnnounceCap = interval * lpd_announceCapFactor;
     583
     584        if( lpd_unsolicitedMsgCounter < 0 )
     585            tr_ninf( "LPD", "Dropped %d announces in the last interval (max. %d "
     586                     "allowed)", -lpd_unsolicitedMsgCounter, maxAnnounceCap );
     587
     588        lpd_unsolicitedMsgCounter = maxAnnounceCap;
    589589    }
    590590
     
    594594/**
    595595* @brief Processing of timeout notifications and incoming data on the socket
    596 * @note maximum rate of read events is limited according to @a lds_maxAnnounceCap
     596* @note maximum rate of read events is limited according to @a lpd_maxAnnounceCap
    597597* @see DoS */
    598598static void event_callback( int s UNUSED, short type, void* ignore UNUSED )
     
    600600    assert( tr_isSession( session ) );
    601601
    602     /* do not allow announces to be processed if LDS is disabled */
    603     if( !tr_sessionAllowsLDS( session ) )
     602    /* do not allow announces to be processed if LPD is disabled */
     603    if( !tr_sessionAllowsLPD( session ) )
    604604        return;
    605605
     
    610610
    611611        /* be paranoid enough about zero terminating the foreign string */
    612         char foreignMsg[lds_maxDatagramLength + 1] = { };
     612        char foreignMsg[lpd_maxDatagramLength + 1] = { };
    613613
    614614        /* process local announcement from foreign peer */
    615         int res = recvfrom( lds_socket, foreignMsg, lds_maxDatagramLength,
     615        int res = recvfrom( lpd_socket, foreignMsg, lpd_maxDatagramLength,
    616616            0, (struct sockaddr*) &foreignAddr, (socklen_t*) &addrLen );
    617617
    618618        /* besides, do we get flooded? then bail out! */
    619         if( --lds_unsolicitedMsgCounter < 0 )
     619        if( --lpd_unsolicitedMsgCounter < 0 )
    620620            return;
    621621
    622         if( res > 0 && res <= lds_maxDatagramLength )
     622        if( res > 0 && res <= lpd_maxDatagramLength )
    623623        {
    624624            struct tr_pex foreignPeer =
     
    629629
    630630            foreignPeer.addr.addr.addr4 = foreignAddr.sin_addr;
    631             if( tr_ldsConsiderAnnounce( &foreignPeer, foreignMsg ) != 0 )
     631            if( tr_lpdConsiderAnnounce( &foreignPeer, foreignMsg ) != 0 )
    632632                return; /* OK so far, no log message */
    633633        }
    634634
    635         tr_ndbg( "LDS", "Discarded invalid multicast message" );
    636     }
    637 }
    638 
     635        tr_ndbg( "LPD", "Discarded invalid multicast message" );
     636    }
     637}
     638
  • trunk/libtransmission/tr-lpd.h

    r10634 r10635  
    2121*/
    2222
    23 #ifndef _TR_LDS_H
    24 #define _TR_LDS_H
     23#ifndef _TR_LPD_H
     24#define _TR_LPD_H
    2525
    2626/* $Id$ */
    2727
    28 int tr_ldsInit( tr_session*, tr_address* );
    29 void tr_ldsUninit( tr_session* );
     28int tr_lpdInit( tr_session*, tr_address* );
     29void tr_lpdUninit( tr_session* );
    3030
    31 tr_bool tr_ldsEnabled( const tr_session* );
     31tr_bool tr_lpdEnabled( const tr_session* );
    3232
    33 tr_bool tr_ldsSendAnnounce( const tr_torrent* );
     33tr_bool tr_lpdSendAnnounce( const tr_torrent* );
    3434
    35 int tr_ldsAnnounceMore( const time_t, const int );
     35int tr_lpdAnnounceMore( const time_t, const int );
    3636
    3737/**
     
    5454* @} */
    5555
    56 #endif /* _TR_LDS_H */
     56#endif /* _TR_LPD_H */
    5757
  • trunk/libtransmission/transmission.h

    r10613 r10635  
    165165#define TR_PREFS_KEY_BLOCKLIST_ENABLED          "blocklist-enabled"
    166166#define TR_PREFS_KEY_DHT_ENABLED                "dht-enabled"
    167 #define TR_PREFS_KEY_LDS_ENABLED                "lds-enabled"
     167#define TR_PREFS_KEY_LPD_ENABLED                "lpd-enabled"
    168168#define TR_PREFS_KEY_DOWNLOAD_DIR               "download-dir"
    169169#define TR_PREFS_KEY_ENCRYPTION                 "encryption"
     
    593593void               tr_sessionSetDHTEnabled( tr_session * session, tr_bool );
    594594
    595 tr_bool            tr_sessionIsLDSEnabled( const tr_session * session );
    596 
    597 void               tr_sessionSetLDSEnabled( tr_session * session, tr_bool enabled );
     595tr_bool            tr_sessionIsLPDEnabled( const tr_session * session );
     596
     597void               tr_sessionSetLPDEnabled( tr_session * session, tr_bool enabled );
    598598
    599599void               tr_sessionSetLazyBitfieldEnabled( tr_session * session,
     
    16541654{
    16551655    TR_PEER_FROM_INCOMING  = 0, /* connections made to the listening port */
    1656     TR_PEER_FROM_LDS,           /* peers discovered by local announcements */
     1656    TR_PEER_FROM_LPD,           /* peers discovered by local announcements */
    16571657    TR_PEER_FROM_TRACKER,       /* peers received from a tracker */
    16581658    TR_PEER_FROM_DHT,           /* peers learnt from the DHT */
  • trunk/qt/prefs-dialog.cc

    r10632 r10635  
    478478    hig->addWideControl( w = checkBoxNew( tr( "Use &DHT to find more peers" ), Prefs::DHT_ENABLED ) );
    479479    w->setToolTip( tr( "DHT is a tool for finding peers without a tracker." ) );
    480     hig->addWideControl( w = checkBoxNew( tr( "Use &LDS to find local peers" ), Prefs::LDS_ENABLED ) );
    481     w->setToolTip( tr( "LDS is a tool for finding peers on your local network." ) );
     480    hig->addWideControl( w = checkBoxNew( tr( "Use &Local Peer Discovery to find more peers" ), Prefs::LPD_ENABLED ) );
     481    w->setToolTip( tr( "LPD is a tool for finding peers on your local network." ) );
    482482
    483483    hig->finish( );
  • trunk/qt/prefs.cc

    r10611 r10635  
    9494    { PEX_ENABLED, TR_PREFS_KEY_PEX_ENABLED, QVariant::Bool },
    9595    { DHT_ENABLED, TR_PREFS_KEY_DHT_ENABLED, QVariant::Bool },
    96     { LDS_ENABLED, TR_PREFS_KEY_LDS_ENABLED, QVariant::Bool },
     96    { LPD_ENABLED, TR_PREFS_KEY_LPD_ENABLED, QVariant::Bool },
    9797    { PORT_FORWARDING, TR_PREFS_KEY_PORT_FORWARDING, QVariant::Bool },
    9898    { PROXY_AUTH_ENABLED, TR_PREFS_KEY_PROXY_AUTH_ENABLED, QVariant::Bool },
  • trunk/qt/prefs.h

    r10611 r10635  
    9898            PEX_ENABLED,
    9999            DHT_ENABLED,
    100             LDS_ENABLED,
     100            LPD_ENABLED,
    101101            PORT_FORWARDING,
    102102            PROXY_AUTH_ENABLED,
  • trunk/qt/session.cc

    r10631 r10635  
    142142        case Prefs :: INCOMPLETE_DIR:
    143143        case Prefs :: INCOMPLETE_DIR_ENABLED:
    144         case Prefs :: LDS_ENABLED:
     144        case Prefs :: LPD_ENABLED:
    145145        case Prefs :: PEER_LIMIT_GLOBAL:
    146146        case Prefs :: PEER_LIMIT_TORRENT:
Note: See TracChangeset for help on using the changeset viewer.