Changeset 10635
- Timestamp:
- May 8, 2010, 8:42:45 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 20 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Transmission.xcodeproj/project.pbxproj
r10609 r10635 105 105 A21FBBAB0EDA78C300BC3C51 /* bandwidth.h in Headers */ = {isa = PBXBuildFile; fileRef = A21FBBA90EDA78C300BC3C51 /* bandwidth.h */; }; 106 106 A21FBBAC0EDA78C300BC3C51 /* bandwidth.c in Sources */ = {isa = PBXBuildFile; fileRef = A21FBBAA0EDA78C300BC3C51 /* bandwidth.c */; }; 107 A220EC5B118C8A060022B4BE /* tr-l ds.c in Sources */ = {isa = PBXBuildFile; fileRef = A220EC59118C8A060022B4BE /* tr-lds.c */; };108 A220EC5C118C8A060022B4BE /* tr-l ds.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 */; }; 109 109 A22180980D148A71007D09ED /* GroupsPrefsController.m in Sources */ = {isa = PBXBuildFile; fileRef = A22180970D148A71007D09ED /* GroupsPrefsController.m */; }; 110 110 A221DCC8104B3660008A642D /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A221DCC7104B3660008A642D /* Quartz.framework */; }; … … 547 547 A21FBBA90EDA78C300BC3C51 /* bandwidth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bandwidth.h; path = libtransmission/bandwidth.h; sourceTree = "<group>"; }; 548 548 A21FBBAA0EDA78C300BC3C51 /* bandwidth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bandwidth.c; path = libtransmission/bandwidth.c; sourceTree = "<group>"; }; 549 A220EC59118C8A060022B4BE /* tr-l ds.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "tr-lds.c"; path = "libtransmission/tr-lds.c"; sourceTree = "<group>"; };550 A220EC5A118C8A060022B4BE /* tr-l ds.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>"; }; 551 551 A22180960D148A71007D09ED /* GroupsPrefsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GroupsPrefsController.h; path = macosx/GroupsPrefsController.h; sourceTree = "<group>"; }; 552 552 A22180970D148A71007D09ED /* GroupsPrefsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GroupsPrefsController.m; path = macosx/GroupsPrefsController.m; sourceTree = "<group>"; }; … … 1213 1213 A22CFCA60FC24ED80009BD3E /* tr-dht.c */, 1214 1214 A22CFCA70FC24ED80009BD3E /* tr-dht.h */, 1215 A220EC59118C8A060022B4BE /* tr-l ds.c */,1216 A220EC5A118C8A060022B4BE /* tr-l ds.h */,1215 A220EC59118C8A060022B4BE /* tr-lpd.c */, 1216 A220EC5A118C8A060022B4BE /* tr-lpd.h */, 1217 1217 A2AAB65B0DE0CF6200E04DDA /* rpcimpl.c */, 1218 1218 A2AAB6590DE0CF6200E04DDA /* rpcimpl.h */, … … 1570 1570 A209EE5D1144B51E002B02D1 /* history.h in Headers */, 1571 1571 A247A443114C701800547DFC /* InfoViewController.h in Headers */, 1572 A220EC5C118C8A060022B4BE /* tr-l ds.h in Headers */,1572 A220EC5C118C8A060022B4BE /* tr-lpd.h in Headers */, 1573 1573 ); 1574 1574 runOnlyForDeploymentPostprocessing = 0; … … 2041 2041 4D80185910BBC0B0008A4AF2 /* magnet.c in Sources */, 2042 2042 A209EE5C1144B51E002B02D1 /* history.c in Sources */, 2043 A220EC5B118C8A060022B4BE /* tr-l ds.c in Sources */,2043 A220EC5B118C8A060022B4BE /* tr-lpd.c in Sources */, 2044 2044 ); 2045 2045 runOnlyForDeploymentPostprocessing = 0; -
trunk/daemon/daemon.c
r10606 r10635 86 86 { 'o', "dht", "Enable distributed hash tables (DHT)", "o", 0, NULL }, 87 87 { 'O', "no-dht", "Disable distributed hash tables (DHT)", "O", 0, NULL }, 88 { 'z', "lds", "Enable local peer discovery (L DS)", "z", 0, NULL },89 { 'Z', "no-lds", "Disable local peer discovery (L DS)", "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 }, 90 90 { 'P', "peerport", "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "P", 1, "<port>" }, 91 91 { 'm', "portmap", "Enable portmapping via NAT-PMP or UPnP", "m", 0, NULL }, … … 409 409 tr_bencDictAddBool( &settings, TR_PREFS_KEY_RATIO_ENABLED, FALSE ); 410 410 break; 411 case 'z': tr_bencDictAddBool( &settings, TR_PREFS_KEY_L DS_ENABLED, TRUE );412 break; 413 case 'Z': tr_bencDictAddBool( &settings, TR_PREFS_KEY_L DS_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 ); 414 414 break; 415 415 default: showUsage( ); -
trunk/daemon/remote.c
r10626 r10635 256 256 { 'x', "pex", "Enable peer exchange (PEX)", "x", 0, NULL }, 257 257 { 'X', "no-pex", "Disable peer exchange (PEX)", "X", 0, NULL }, 258 { 'z', "lds", "Enable local peer discovery (L DS)", "z", 0, NULL },259 { 'Z', "no-lds", "Disable local peer discovery (L DS)", "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 }, 260 260 { 940, "peer-info", "List the current torrent(s)' peers", "pi", 0, NULL }, 261 261 { 0, NULL, NULL, NULL, 0, NULL } … … 1344 1344 if( tr_bencDictFindBool( args, TR_PREFS_KEY_DHT_ENABLED, &boolVal ) ) 1345 1345 printf( " Distributed hash table enabled: %s\n", ( boolVal ? "Yes" : "No" ) ); 1346 if( tr_bencDictFindBool( args, TR_PREFS_KEY_L DS_ENABLED, &boolVal ) )1346 if( tr_bencDictFindBool( args, TR_PREFS_KEY_LPD_ENABLED, &boolVal ) ) 1347 1347 printf( " Local peer discovery enabled: %s\n", ( boolVal ? "Yes" : "No" ) ); 1348 1348 if( tr_bencDictFindBool( args, TR_PREFS_KEY_PEX_ENABLED, &boolVal ) ) … … 1824 1824 case 'X': tr_bencDictAddBool( args, TR_PREFS_KEY_PEX_ENABLED, FALSE ); 1825 1825 break; 1826 case 'z': tr_bencDictAddBool( args, TR_PREFS_KEY_L DS_ENABLED, TRUE );1827 break; 1828 case 'Z': tr_bencDictAddBool( args, TR_PREFS_KEY_L DS_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 ); 1829 1829 break; 1830 1830 case 953: tr_bencDictAddReal( args, "seedRatioLimit", atof(optarg) ); -
trunk/daemon/transmission-remote.1
r10611 r10635 249 249 Disable peer exchange (PEX). 250 250 .It Fl z Fl -lds 251 Enable local peer discovery (L DS).251 Enable local peer discovery (LPD). 252 252 .It Fl Z Fl -no-lds 253 Disable local peer discovery (L DS).253 Disable local peer discovery (LPD). 254 254 .It Fl pi Fl -peer-info 255 255 List the current torrent's connected peers. -
trunk/doc/rpc-spec.txt
r10608 r10635 406 406 "incomplete-dir" | string path for incomplete torrents, when enabled 407 407 "incomplete-dir-enabled" | boolean true means keep torrents in incomplete-dir until done 408 "l ds-enabled" | boolean true means allow ldsin public torrents408 "lpd-enabled" | boolean true means allow Local Peer Discovery in public torrents 409 409 "peer-limit-global" | number maximum global number of peers 410 410 "peer-limit-per-torrent" | number maximum global number of peers -
trunk/gtk/main.c
r10611 r10635 1222 1222 tr_sessionSetDHTEnabled( tr, pref_flag_get( key ) ); 1223 1223 } 1224 else if( !strcmp( key, TR_PREFS_KEY_L DS_ENABLED ) )1225 { 1226 tr_sessionSetL DSEnabled( tr, pref_flag_get( key ) );1224 else if( !strcmp( key, TR_PREFS_KEY_LPD_ENABLED ) ) 1225 { 1226 tr_sessionSetLPDEnabled( tr, pref_flag_get( key ) ); 1227 1227 } 1228 1228 else if( !strcmp( key, TR_PREFS_KEY_RPC_PORT ) ) -
trunk/gtk/tr-prefs.c
r10611 r10635 555 555 hig_workarea_add_wide_control( t, &row, w ); 556 556 557 s = _( "Use L DS to find localpeers" );558 w = new_check_button( s, TR_PREFS_KEY_L DS_ENABLED, core );559 s = _( "L DSis 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." ); 560 560 gtr_widget_set_tooltip_text( w, s ); 561 561 hig_workarea_add_wide_control( t, &row, w ); -
trunk/libtransmission/Makefile.am
r10606 r10635 56 56 torrent-magnet.c \ 57 57 tr-dht.c \ 58 tr-l ds.c \58 tr-lpd.c \ 59 59 tr-getopt.c \ 60 60 trevent.c \ … … 109 109 transmission.h \ 110 110 tr-dht.h \ 111 tr-l ds.h \111 tr-lpd.h \ 112 112 trevent.h \ 113 113 upnp.h \ -
trunk/libtransmission/announcer.c
r10606 r10635 25 25 #include "session.h" 26 26 #include "tr-dht.h" 27 #include "tr-l ds.h"27 #include "tr-lpd.h" 28 28 #include "torrent.h" 29 29 #include "utils.h" … … 70 70 71 71 /* this is an upper limit for the frequency of LDS announces */ 72 L DS_HOUSEKEEPING_INTERVAL_SECS = 3072 LPD_HOUSEKEEPING_INTERVAL_SECS = 30 73 73 74 74 }; … … 207 207 struct event * upkeepTimer; 208 208 int slotsAvailable; 209 time_t l dsHouseKeepingAt;209 time_t lpdHouseKeepingAt; 210 210 } 211 211 tr_announcer; … … 255 255 256 256 const time_t relaxUntil = 257 calcRescheduleWithJitter( L DS_HOUSEKEEPING_INTERVAL_SECS / 3 );257 calcRescheduleWithJitter( LPD_HOUSEKEEPING_INTERVAL_SECS / 3 ); 258 258 259 259 assert( tr_isSession( session ) ); … … 264 264 a->session = session; 265 265 a->slotsAvailable = MAX_CONCURRENT_TASKS; 266 a->l dsHouseKeepingAt = relaxUntil;266 a->lpdHouseKeepingAt = relaxUntil; 267 267 a->upkeepTimer = tr_new0( struct event, 1 ); 268 268 evtimer_set( a->upkeepTimer, onUpkeepTimer, a ); … … 1908 1908 1909 1909 /* Local Peer Discovery */ 1910 if( announcer->l dsHouseKeepingAt <= now )1911 { 1912 tr_l dsAnnounceMore( now, LDS_HOUSEKEEPING_INTERVAL_SECS );1910 if( announcer->lpdHouseKeepingAt <= now ) 1911 { 1912 tr_lpdAnnounceMore( now, LPD_HOUSEKEEPING_INTERVAL_SECS ); 1913 1913 1914 1914 /* reschedule more LDS announces for ( the future + jitter ) */ 1915 announcer->l dsHouseKeepingAt =1916 calcRescheduleWithJitter( L DS_HOUSEKEEPING_INTERVAL_SECS );1915 announcer->lpdHouseKeepingAt = 1916 calcRescheduleWithJitter( LPD_HOUSEKEEPING_INTERVAL_SECS ); 1917 1917 } 1918 1918 } -
trunk/libtransmission/peer-mgr.c
r10606 r10635 1509 1509 case TR_PEER_FROM_PEX : return 60 * 60 * 2; 1510 1510 case TR_PEER_FROM_RESUME : return 60 * 60; 1511 case TR_PEER_FROM_L DS: return 10 * 60;1511 case TR_PEER_FROM_LPD : return 10 * 60; 1512 1512 default : return 60 * 60; 1513 1513 } -
trunk/libtransmission/rpcimpl.c
r10606 r10635 1215 1215 if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_DHT_ENABLED, &boolVal ) ) 1216 1216 tr_sessionSetDHTEnabled( session, boolVal ); 1217 if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_L DS_ENABLED, &boolVal ) )1218 tr_sessionSetL DSEnabled( session, boolVal );1217 if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_LPD_ENABLED, &boolVal ) ) 1218 tr_sessionSetLPDEnabled( session, boolVal ); 1219 1219 if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_PEER_PORT_RANDOM_ON_START, &boolVal ) ) 1220 1220 tr_sessionSetPeerPortRandomOnStart( session, boolVal ); … … 1329 1329 tr_bencDictAddBool( d, TR_PREFS_KEY_PEX_ENABLED, tr_sessionIsPexEnabled( s ) ); 1330 1330 tr_bencDictAddBool( d, TR_PREFS_KEY_DHT_ENABLED, tr_sessionIsDHTEnabled( s ) ); 1331 tr_bencDictAddBool( d, TR_PREFS_KEY_L DS_ENABLED, tr_sessionIsLDSEnabled( s ) );1331 tr_bencDictAddBool( d, TR_PREFS_KEY_LPD_ENABLED, tr_sessionIsLPDEnabled( s ) ); 1332 1332 tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_PORT, tr_sessionGetPeerPort( s ) ); 1333 1333 tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_PORT_RANDOM_ON_START, tr_sessionGetPeerPortRandomOnStart( s ) ); -
trunk/libtransmission/session.c
r10606 r10635 43 43 #include "torrent.h" 44 44 #include "tr-dht.h" 45 #include "tr-l ds.h"45 #include "tr-lpd.h" 46 46 #include "trevent.h" 47 47 #include "utils.h" … … 246 246 tr_bencDictAddBool( d, TR_PREFS_KEY_BLOCKLIST_ENABLED, FALSE ); 247 247 tr_bencDictAddBool( d, TR_PREFS_KEY_DHT_ENABLED, TRUE ); 248 tr_bencDictAddBool( d, TR_PREFS_KEY_L DS_ENABLED, FALSE );248 tr_bencDictAddBool( d, TR_PREFS_KEY_LPD_ENABLED, FALSE ); 249 249 tr_bencDictAddStr ( d, TR_PREFS_KEY_DOWNLOAD_DIR, tr_getDefaultDownloadDir( ) ); 250 250 tr_bencDictAddInt ( d, TR_PREFS_KEY_DSPEED, 100 ); … … 309 309 tr_bencDictAddBool( d, TR_PREFS_KEY_BLOCKLIST_ENABLED, tr_blocklistIsEnabled( s ) ); 310 310 tr_bencDictAddBool( d, TR_PREFS_KEY_DHT_ENABLED, s->isDHTEnabled ); 311 tr_bencDictAddBool( d, TR_PREFS_KEY_L DS_ENABLED, s->isLDSEnabled );311 tr_bencDictAddBool( d, TR_PREFS_KEY_LPD_ENABLED, s->isLPDEnabled ); 312 312 tr_bencDictAddStr ( d, TR_PREFS_KEY_DOWNLOAD_DIR, s->downloadDir ); 313 313 tr_bencDictAddInt ( d, TR_PREFS_KEY_DSPEED, tr_sessionGetSpeedLimit( s, TR_DOWN ) ); … … 629 629 } 630 630 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" ) ); 638 635 639 636 /* cleanup */ … … 679 676 if( tr_bencDictFindBool( settings, TR_PREFS_KEY_DHT_ENABLED, &boolVal ) ) 680 677 tr_sessionSetDHTEnabled( session, boolVal ); 681 if( tr_bencDictFindBool( settings, TR_PREFS_KEY_L DS_ENABLED, &boolVal ) )682 tr_sessionSetL DSEnabled( session, boolVal );678 if( tr_bencDictFindBool( settings, TR_PREFS_KEY_LPD_ENABLED, &boolVal ) ) 679 tr_sessionSetLPDEnabled( session, boolVal ); 683 680 if( tr_bencDictFindInt( settings, TR_PREFS_KEY_ENCRYPTION, &i ) ) 684 681 tr_sessionSetEncryption( session, i ); … … 1565 1562 free_incoming_peer_port( session ); 1566 1563 1567 if( session->isL DSEnabled )1568 tr_l dsUninit( session );1564 if( session->isLPDEnabled ) 1565 tr_lpdUninit( session ); 1569 1566 1570 1567 if( session->isDHTEnabled ) … … 1803 1800 1804 1801 void 1805 tr_sessionSetL DSEnabled( tr_session * session,1802 tr_sessionSetLPDEnabled( tr_session * session, 1806 1803 tr_bool enabled ) 1807 1804 { 1808 1805 assert( tr_isSession( session ) ); 1809 1806 1810 session->isL DSEnabled = ( enabled != 0 );1811 } 1812 1813 tr_bool 1814 tr_sessionIsL DSEnabled( const tr_session * session )1815 { 1816 assert( tr_isSession( session ) ); 1817 1818 return session->isL DSEnabled;1819 } 1820 1821 tr_bool 1822 tr_sessionAllowsL DS( const tr_session * session )1823 { 1824 return tr_sessionIsL DSEnabled( session );1807 session->isLPDEnabled = ( enabled != 0 ); 1808 } 1809 1810 tr_bool 1811 tr_sessionIsLPDEnabled( const tr_session * session ) 1812 { 1813 assert( tr_isSession( session ) ); 1814 1815 return session->isLPDEnabled; 1816 } 1817 1818 tr_bool 1819 tr_sessionAllowsLPD( const tr_session * session ) 1820 { 1821 return tr_sessionIsLPDEnabled( session ); 1825 1822 } 1826 1823 -
trunk/libtransmission/session.h
r10606 r10635 85 85 tr_bool isPexEnabled; 86 86 tr_bool isDHTEnabled; 87 tr_bool isL DSEnabled;87 tr_bool isLPDEnabled; 88 88 tr_bool isBlocklistEnabled; 89 89 tr_bool isProxyEnabled; … … 181 181 tr_bool tr_sessionAllowsDHT( const tr_session * session ); 182 182 183 tr_bool tr_sessionAllowsL DS( const tr_session * session );183 tr_bool tr_sessionAllowsLPD( const tr_session * session ); 184 184 185 185 const char * tr_sessionFindTorrentFile( const tr_session * session, -
trunk/libtransmission/torrent.c
r10606 r10635 1401 1401 tor->dhtAnnounceAt = now + tr_cryptoWeakRandInt( 20 ); 1402 1402 tor->dhtAnnounce6At = now + tr_cryptoWeakRandInt( 20 ); 1403 tor->l dsAnnounceAt = now;1403 tor->lpdAnnounceAt = now; 1404 1404 tr_peerMgrStartTorrent( tor ); 1405 1405 } -
trunk/libtransmission/torrent.h
r10606 r10635 201 201 tr_bool dhtAnnounce6InProgress; 202 202 203 time_t l dsAnnounceAt;203 time_t lpdAnnounceAt; 204 204 205 205 uint64_t downloadedCur; … … 335 335 } 336 336 337 static inline tr_bool tr_torrentAllowsL DS( const tr_torrent * tor )337 static inline tr_bool tr_torrentAllowsLPD( const tr_torrent * tor ) 338 338 { 339 339 return ( tor != NULL ) 340 && ( tr_sessionAllowsL DS( tor->session ) )340 && ( tr_sessionAllowsLPD( tor->session ) ) 341 341 && ( !tr_torrentIsPrivate( tor ) ); 342 342 } -
trunk/libtransmission/tr-lpd.c
r10634 r10635 45 45 #include "session.h" 46 46 #include "torrent.h" /* tr_torrentFindFromHash() */ 47 #include "tr-l ds.h"47 #include "tr-lpd.h" 48 48 #include "utils.h" 49 49 #include "version.h" … … 51 51 /** 52 52 * @brief Local Peer Discovery 53 * @file tr-l ds.c54 * 55 * This module implements the Local Peer Discovery (L DS) protocol as supported by the56 * uTorrent client application. A typical L DSdatagram 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. 57 57 * 58 58 * $Id$ … … 61 61 static void event_callback( int, short, void* ); 62 62 63 static int l ds_socket; /**<separate multicast receive socket */64 static int l ds_socket2; /**<and multicast send socket */65 static struct event l ds_event;66 static tr_port l ds_port;67 68 static tr_torrent* l ds_torStaticType UNUSED; /* just a helper for static type analysis */63 static int lpd_socket; /**<separate multicast receive socket */ 64 static int lpd_socket2; /**<and multicast send socket */ 65 static struct event lpd_event; 66 static tr_port lpd_port; 67 68 static tr_torrent* lpd_torStaticType UNUSED; /* just a helper for static type analysis */ 69 69 static tr_session* session; 70 70 71 enum { l ds_maxDatagramLength = 200 }; /**<the size an LDSdatagram must not exceed */72 const char l ds_mcastGroup[] = "239.192.152.143"; /**<LDSmulticast group */73 const int l ds_mcastPort = 6771; /**<LDSsource and destination UPD port */74 static struct sockaddr_in l ds_mcastAddr; /**<initialized from the above constants in tr_ldsInit */71 enum { lpd_maxDatagramLength = 200 }; /**<the size an LPD datagram must not exceed */ 72 const char lpd_mcastGroup[] = "239.192.152.143"; /**<LPD multicast group */ 73 const int lpd_mcastPort = 6771; /**<LPD source and destination UPD port */ 74 static struct sockaddr_in lpd_mcastAddr; /**<initialized from the above constants in tr_lpdInit */ 75 75 76 76 /** 77 77 * @brief Protocol-related information carried by a Local Peer Discovery packet */ 78 struct l ds_protocolVersion78 struct lpd_protocolVersion 79 79 { 80 80 int major, minor; 81 81 }; 82 82 83 enum l ds_enumTimeToLive {84 l ds_ttlSameSubnet = 1,85 l ds_ttlSameSite = 32,86 l ds_ttlSameRegion = 64,87 l ds_ttlSameContinent = 128,88 l ds_ttlUnrestricted = 25583 enum lpd_enumTimeToLive { 84 lpd_ttlSameSubnet = 1, 85 lpd_ttlSameSite = 32, 86 lpd_ttlSameRegion = 64, 87 lpd_ttlSameContinent = 128, 88 lpd_ttlUnrestricted = 255 89 89 }; 90 90 91 91 enum { 92 l ds_announceInterval = 4 * 60, /**<4 min announce interval per torrent */93 l ds_announceScope = lds_ttlSameSubnet /**<the maximum scope for LDSdatagrams */92 lpd_announceInterval = 4 * 60, /**<4 min announce interval per torrent */ 93 lpd_announceScope = lpd_ttlSameSubnet /**<the maximum scope for LPD datagrams */ 94 94 }; 95 95 … … 113 113 * @brief allow at most ten messages per second (interval average) 114 114 * @note this constraint is only enforced once per housekeeping interval */ 115 enum { l ds_announceCapFactor = 10 };115 enum { lpd_announceCapFactor = 10 }; 116 116 117 117 /** … … 119 119 * @brief number of unsolicited messages during the last HK interval 120 120 * @remark counts downwards */ 121 static int l ds_unsolicitedMsgCounter;121 static int lpd_unsolicitedMsgCounter; 122 122 123 123 /** 124 124 * @def CRLF 125 * @brief a line-feed, as understood by the L DSprotocol */125 * @brief a line-feed, as understood by the LPD protocol */ 126 126 #define CRLF "\r\n" 127 127 … … 145 145 * in this case the function returns a character sequence beginning with CRLF). 146 146 * If parameter is not NULL, the declared protocol version is returned as part of 147 * the l ds_protocolVersion structure.148 */ 149 static const char* l ds_extractHeader( const char* s, struct lds_protocolVersion* const ver )147 * the lpd_protocolVersion structure. 148 */ 149 static const char* lpd_extractHeader( const char* s, struct lpd_protocolVersion* const ver ) 150 150 { 151 151 int major = -1, minor = -1; … … 156 156 157 157 /* something might be rotten with this chunk of data */ 158 if( len == 0 || len > l ds_maxDatagramLength )158 if( len == 0 || len > lpd_maxDatagramLength ) 159 159 return NULL; 160 160 … … 199 199 * - copy back value from end to next "\r\n" 200 200 */ 201 static int l ds_extractParam( const char* const str, const char* const name, int n, char* const val )201 static int lpd_extractParam( const char* const str, const char* const name, int n, char* const val ) 202 202 { 203 203 /* configure maximum length of search string here */ … … 245 245 /** 246 246 * @brief Configures additional capabilities for a socket */ 247 static inline int l ds_configureSocket( int sock, int add )247 static inline int lpd_configureSocket( int sock, int add ) 248 248 { 249 249 /* read-modify-write socket flags */ … … 265 265 * and event-based message handling. 266 266 * 267 * @remark Since the L DSservice does not use another protocol family yet, this code is267 * @remark Since the LPD service does not use another protocol family yet, this code is 268 268 * IPv4 only for the time being. 269 269 */ 270 int tr_l dsInit( tr_session* ss, tr_address* tr_addr UNUSED )270 int tr_lpdInit( tr_session* ss, tr_address* tr_addr UNUSED ) 271 271 { 272 272 struct ip_mreq mcastReq; … … 276 276 return -1; 277 277 278 assert( l ds_announceInterval > 0 );279 assert( l ds_announceScope > 0 );280 281 l ds_port = tr_sessionGetPeerPort( ss );282 if( l ds_port <= 0 )278 assert( lpd_announceInterval > 0 ); 279 assert( lpd_announceScope > 0 ); 280 281 lpd_port = tr_sessionGetPeerPort( ss ); 282 if( lpd_port <= 0 ) 283 283 return -1; 284 284 285 tr_ndbg( "L DS", "Initialising Local Peer Discovery" );285 tr_ndbg( "LPD", "Initialising Local Peer Discovery" ); 286 286 287 287 /* setup datagram socket (receive) */ 288 288 { 289 l ds_socket = socket( PF_INET, SOCK_DGRAM, 0 );290 if( l ds_socket < 0 )289 lpd_socket = socket( PF_INET, SOCK_DGRAM, 0 ); 290 if( lpd_socket < 0 ) 291 291 goto fail; 292 292 293 293 /* enable non-blocking operation */ 294 if( l ds_configureSocket( lds_socket, O_NONBLOCK ) < 0 )295 goto fail; 296 297 if( setsockopt( l ds_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, 298 298 &opt_on, sizeof opt_on ) < 0 ) 299 299 goto fail; 300 300 301 memset( &l ds_mcastAddr, 0, sizeof lds_mcastAddr );302 l ds_mcastAddr.sin_family = AF_INET;303 l ds_mcastAddr.sin_port = htons( lds_mcastPort );304 if( inet_pton( l ds_mcastAddr.sin_family, lds_mcastGroup,305 &l ds_mcastAddr.sin_addr ) < 0 )306 goto fail; 307 308 if( bind( l ds_socket, (struct sockaddr*) &lds_mcastAddr,309 sizeof l ds_mcastAddr ) < 0 )310 goto fail; 311 312 /* we want to join that L DSmulticast 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 */ 313 313 memset( &mcastReq, 0, sizeof mcastReq ); 314 mcastReq.imr_multiaddr = l ds_mcastAddr.sin_addr;314 mcastReq.imr_multiaddr = lpd_mcastAddr.sin_addr; 315 315 mcastReq.imr_interface.s_addr = htonl( INADDR_ANY ); 316 if( setsockopt( l ds_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP,316 if( setsockopt( lpd_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, 317 317 &mcastReq, sizeof mcastReq ) < 0 ) 318 318 goto fail; 319 319 320 if( setsockopt( l ds_socket, IPPROTO_IP, IP_MULTICAST_LOOP,320 if( setsockopt( lpd_socket, IPPROTO_IP, IP_MULTICAST_LOOP, 321 321 &opt_off, sizeof opt_off ) < 0 ) 322 322 goto fail; … … 325 325 /* setup datagram socket (send) */ 326 326 { 327 const unsigned char scope = l ds_announceScope;328 329 l ds_socket2 = socket( PF_INET, SOCK_DGRAM, 0 );330 if( l ds_socket2 < 0 )327 const unsigned char scope = lpd_announceScope; 328 329 lpd_socket2 = socket( PF_INET, SOCK_DGRAM, 0 ); 330 if( lpd_socket2 < 0 ) 331 331 goto fail; 332 332 333 333 /* enable non-blocking operation */ 334 if( l ds_configureSocket( lds_socket2, O_NONBLOCK ) < 0 )334 if( lpd_configureSocket( lpd_socket2, O_NONBLOCK ) < 0 ) 335 335 goto fail; 336 336 337 337 /* configure outbound multicast TTL */ 338 if( setsockopt( l ds_socket2, IPPROTO_IP, IP_MULTICAST_TTL,338 if( setsockopt( lpd_socket2, IPPROTO_IP, IP_MULTICAST_TTL, 339 339 &scope, sizeof scope ) < 0 ) 340 340 goto fail; 341 341 342 if( setsockopt( l ds_socket2, IPPROTO_IP, IP_MULTICAST_LOOP,342 if( setsockopt( lpd_socket2, IPPROTO_IP, IP_MULTICAST_LOOP, 343 343 &opt_off, sizeof opt_off ) < 0 ) 344 344 goto fail; … … 347 347 session = ss; 348 348 349 /* Note: l ds_unsolicitedMsgCounter remains 0 until the first timeout event, thus349 /* Note: lpd_unsolicitedMsgCounter remains 0 until the first timeout event, thus 350 350 * any announcement received during the initial interval will be discarded. */ 351 351 352 event_set( &l ds_event, lds_socket, EV_READ | EV_PERSIST, event_callback, NULL );353 event_add( &l ds_event, NULL );354 355 tr_ndbg( "L DS", "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" ); 356 356 357 357 return 1; … … 360 360 { 361 361 const int save = errno; 362 close( l ds_socket );363 close( l ds_socket2 );364 l ds_socket = lds_socket2 = -1;362 close( lpd_socket ); 363 close( lpd_socket2 ); 364 lpd_socket = lpd_socket2 = -1; 365 365 session = NULL; 366 tr_ndbg( "L DS", "LDSinitialisation failed (errno = %d)", save );366 tr_ndbg( "LPD", "LPD initialisation failed (errno = %d)", save ); 367 367 errno = save; 368 368 } … … 372 372 } 373 373 374 void tr_l dsUninit( tr_session* ss )374 void tr_lpdUninit( tr_session* ss ) 375 375 { 376 376 if( session != ss ) 377 377 return; 378 378 379 tr_ndbg( "L DS", "Uninitialising Local Peer Discovery" );380 381 event_del( &l ds_event );379 tr_ndbg( "LPD", "Uninitialising Local Peer Discovery" ); 380 381 event_del( &lpd_event ); 382 382 383 383 /* just shut down, we won't remember any former nodes */ 384 EVUTIL_CLOSESOCKET( l ds_socket );385 EVUTIL_CLOSESOCKET( l ds_socket2 );386 tr_ndbg( "L DS", "Done uninitialising Local Peer Discovery" );384 EVUTIL_CLOSESOCKET( lpd_socket ); 385 EVUTIL_CLOSESOCKET( lpd_socket2 ); 386 tr_ndbg( "LPD", "Done uninitialising Local Peer Discovery" ); 387 387 388 388 session = NULL; 389 389 } 390 390 391 tr_bool tr_l dsEnabled( const tr_session* ss )391 tr_bool tr_lpdEnabled( const tr_session* ss ) 392 392 { 393 393 return ss && ( ss == session ); … … 399 399 * @brief Performs some (internal) software consistency checks at compile time. 400 400 * @remark Declared inline for the compiler not to allege us of feeding unused 401 * functions. In any other respect, l ds_consistencyCheck is an orphaned function.402 */ 403 static inline void l ds_consistencyCheck( void )401 * functions. In any other respect, lpd_consistencyCheck is an orphaned function. 402 */ 403 static inline void lpd_consistencyCheck( void ) 404 404 { 405 405 /* if the following check fails, the definition of a hash string has changed 406 * without our knowledge; revise string handling in functions tr_l dsSendAnnounce407 * and tr_l dsConsiderAnnounce. However, the code is designed to function as long406 * without our knowledge; revise string handling in functions tr_lpdSendAnnounce 407 * and tr_lpdConsiderAnnounce. However, the code is designed to function as long 408 408 * as interfaces to the rest of the lib remain compatible with char* strings. */ 409 STATIC_ASSERT( sizeof(l ds_torStaticType->info.hashString[0]) == sizeof(char) );409 STATIC_ASSERT( sizeof(lpd_torStaticType->info.hashString[0]) == sizeof(char) ); 410 410 } 411 411 /** … … 414 414 415 415 /** 416 * @defgroup LdsProto L DSannouncement processing416 * @defgroup LdsProto LPD announcement processing 417 417 * @{ 418 418 */ … … 424 424 * @return Returns TRUE on success 425 425 * 426 * Send a query for torrent t out to the L DSmulticast group (or the LAN, for that426 * Send a query for torrent t out to the LPD multicast group (or the LAN, for that 427 427 * matter). A listening client on the same network might react by adding us to his 428 428 * peer pool for torrent t. 429 429 */ 430 tr_bool tr_l dsSendAnnounce( const tr_torrent* t )430 tr_bool tr_lpdSendAnnounce( const tr_torrent* t ) 431 431 { 432 432 const char fmt[] = … … 439 439 440 440 char hashString[lengthof( t->info.hashString )]; 441 char query[l ds_maxDatagramLength + 1] = { };441 char query[lpd_maxDatagramLength + 1] = { }; 442 442 443 443 if( t == NULL ) … … 449 449 450 450 /* prepare a zero-terminated announce message */ 451 snprintf( query, l ds_maxDatagramLength + 1, fmt, 1, 1,452 l ds_mcastGroup, lds_mcastPort, lds_port, hashString );453 454 /* actually send the query out using [l ds_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] */ 455 455 { 456 456 const int len = strlen( query ); 457 457 458 /* destination address info has already been set up in tr_l dsInit(),458 /* destination address info has already been set up in tr_lpdInit(), 459 459 * so we refrain from preparing another sockaddr_in here */ 460 int res = sendto( l ds_socket2, query, len, 0,461 (const struct sockaddr*) &l ds_mcastAddr, sizeof lds_mcastAddr );460 int res = sendto( lpd_socket2, query, len, 0, 461 (const struct sockaddr*) &lpd_mcastAddr, sizeof lpd_mcastAddr ); 462 462 463 463 if( res != len ) … … 465 465 } 466 466 467 tr_tordbg( t, "L DSannounce message away" );467 tr_tordbg( t, "LPD announce message away" ); 468 468 469 469 return TRUE; … … 480 480 * the peer in/out parameter. 481 481 * 482 * @note The port information gets added to the peer structure if tr_l dsConsiderAnnounce482 * @note The port information gets added to the peer structure if tr_lpdConsiderAnnounce 483 483 * is able to extract the necessary information from the announce message. That is, if 484 484 * return != 0, the caller may retrieve the value from the passed structure. 485 485 */ 486 static int tr_l dsConsiderAnnounce( tr_pex* peer, const char* const msg )486 static int tr_lpdConsiderAnnounce( tr_pex* peer, const char* const msg ) 487 487 { 488 488 enum 489 489 { 490 490 maxValueLen = 25, 491 maxHashLen = lengthof(l ds_torStaticType->info.hashString)491 maxHashLen = lengthof(lpd_torStaticType->info.hashString) 492 492 }; 493 493 494 struct l ds_protocolVersion ver = { -1, -1 };494 struct lpd_protocolVersion ver = { -1, -1 }; 495 495 char value[maxValueLen] = { }; 496 496 char hashString[maxHashLen] = { }; … … 501 501 tr_torrent* tor = NULL; 502 502 503 const char* params = l ds_extractHeader( msg, &ver );503 const char* params = lpd_extractHeader( msg, &ver ); 504 504 if( params == NULL || ver.major != 1 ) /* allow messages of protocol v1 */ 505 505 return 0; … … 507 507 /* save the effort to check Host, which seems to be optional anyway */ 508 508 509 if( l ds_extractParam( params, "Port", maxValueLen, value ) == 0 )509 if( lpd_extractParam( params, "Port", maxValueLen, value ) == 0 ) 510 510 return 0; 511 511 … … 517 517 res = -1; /* signal caller side-effect to peer->port via return != 0 */ 518 518 519 if( l ds_extractParam( params, "Infohash", maxHashLen, hashString ) == 0 )519 if( lpd_extractParam( params, "Infohash", maxHashLen, hashString ) == 0 ) 520 520 return res; 521 521 522 522 tor = tr_torrentFindFromHashString( session, hashString ); 523 523 524 if( tr_isTorrent( tor ) && tr_torrentAllowsL DS( tor ) )524 if( tr_isTorrent( tor ) && tr_torrentAllowsLPD( tor ) ) 525 525 { 526 526 /* we found a suitable peer, add it to the torrent */ 527 tr_peerMgrAddPex( tor, TR_PEER_FROM_L DS, peer, -1 );528 tr_tordbg( tor, "Learned %d local peer from L DS(%s:%u)",527 tr_peerMgrAddPex( tor, TR_PEER_FROM_LPD, peer, -1 ); 528 tr_tordbg( tor, "Learned %d local peer from LPD (%s:%u)", 529 529 1, inet_ntoa( peer->addr.addr.addr4 ), peerPort ); 530 530 … … 534 534 } 535 535 else 536 tr_ndbg( "L DS", "Cannot serve torrent #%s", hashString );536 tr_ndbg( "LPD", "Cannot serve torrent #%s", hashString ); 537 537 } 538 538 … … 544 544 545 545 /** 546 * @note Since it possible for tr_l dsAnnounceMore to get called from outside the LDSmodule,546 * @note Since it possible for tr_lpdAnnounceMore to get called from outside the LPD module, 547 547 * 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 L DS548 * Further, by setting interval to zero (or negative) the caller may actually disable LPD 549 549 * announces on a per-interval basis. 550 550 */ 551 int tr_l dsAnnounceMore( const time_t now, const int interval )551 int tr_lpdAnnounceMore( const time_t now, const int interval ) 552 552 { 553 553 tr_torrent* tor = NULL; … … 558 558 559 559 while(( tor = tr_torrentNext( session, tor ) ) 560 && tr_sessionAllowsL DS( session ) )560 && tr_sessionAllowsLPD( session ) ) 561 561 { 562 562 if( tr_isTorrent( tor ) ) 563 563 { 564 if( !tr_torrentAllowsL DS( tor ) || (564 if( !tr_torrentAllowsLPD( tor ) || ( 565 565 ( tr_torrentGetActivity( tor ) != TR_STATUS_DOWNLOAD ) && 566 566 ( tr_torrentGetActivity( tor ) != TR_STATUS_SEED ) ) ) 567 567 continue; 568 568 569 if( tor->l dsAnnounceAt <= now )569 if( tor->lpdAnnounceAt <= now ) 570 570 { 571 if( tr_l dsSendAnnounce( tor ) )571 if( tr_lpdSendAnnounce( tor ) ) 572 572 announcesSent++; 573 573 574 tor->l dsAnnounceAt = now + lds_announceInterval;574 tor->lpdAnnounceAt = now + lpd_announceInterval; 575 575 break; /* that's enough; for this interval */ 576 576 } … … 580 580 /* perform housekeeping for the flood protection mechanism */ 581 581 { 582 const int maxAnnounceCap = interval * l ds_announceCapFactor;583 584 if( l ds_unsolicitedMsgCounter < 0 )585 tr_ninf( "L DS", "Dropped %d announces in the last interval (max. %d "586 "allowed)", -l ds_unsolicitedMsgCounter, maxAnnounceCap );587 588 l ds_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; 589 589 } 590 590 … … 594 594 /** 595 595 * @brief Processing of timeout notifications and incoming data on the socket 596 * @note maximum rate of read events is limited according to @a l ds_maxAnnounceCap596 * @note maximum rate of read events is limited according to @a lpd_maxAnnounceCap 597 597 * @see DoS */ 598 598 static void event_callback( int s UNUSED, short type, void* ignore UNUSED ) … … 600 600 assert( tr_isSession( session ) ); 601 601 602 /* do not allow announces to be processed if L DSis disabled */603 if( !tr_sessionAllowsL DS( session ) )602 /* do not allow announces to be processed if LPD is disabled */ 603 if( !tr_sessionAllowsLPD( session ) ) 604 604 return; 605 605 … … 610 610 611 611 /* be paranoid enough about zero terminating the foreign string */ 612 char foreignMsg[l ds_maxDatagramLength + 1] = { };612 char foreignMsg[lpd_maxDatagramLength + 1] = { }; 613 613 614 614 /* process local announcement from foreign peer */ 615 int res = recvfrom( l ds_socket, foreignMsg, lds_maxDatagramLength,615 int res = recvfrom( lpd_socket, foreignMsg, lpd_maxDatagramLength, 616 616 0, (struct sockaddr*) &foreignAddr, (socklen_t*) &addrLen ); 617 617 618 618 /* besides, do we get flooded? then bail out! */ 619 if( --l ds_unsolicitedMsgCounter < 0 )619 if( --lpd_unsolicitedMsgCounter < 0 ) 620 620 return; 621 621 622 if( res > 0 && res <= l ds_maxDatagramLength )622 if( res > 0 && res <= lpd_maxDatagramLength ) 623 623 { 624 624 struct tr_pex foreignPeer = … … 629 629 630 630 foreignPeer.addr.addr.addr4 = foreignAddr.sin_addr; 631 if( tr_l dsConsiderAnnounce( &foreignPeer, foreignMsg ) != 0 )631 if( tr_lpdConsiderAnnounce( &foreignPeer, foreignMsg ) != 0 ) 632 632 return; /* OK so far, no log message */ 633 633 } 634 634 635 tr_ndbg( "L DS", "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 21 21 */ 22 22 23 #ifndef _TR_L DS_H24 #define _TR_L DS_H23 #ifndef _TR_LPD_H 24 #define _TR_LPD_H 25 25 26 26 /* $Id$ */ 27 27 28 int tr_l dsInit( tr_session*, tr_address* );29 void tr_l dsUninit( tr_session* );28 int tr_lpdInit( tr_session*, tr_address* ); 29 void tr_lpdUninit( tr_session* ); 30 30 31 tr_bool tr_l dsEnabled( const tr_session* );31 tr_bool tr_lpdEnabled( const tr_session* ); 32 32 33 tr_bool tr_l dsSendAnnounce( const tr_torrent* );33 tr_bool tr_lpdSendAnnounce( const tr_torrent* ); 34 34 35 int tr_l dsAnnounceMore( const time_t, const int );35 int tr_lpdAnnounceMore( const time_t, const int ); 36 36 37 37 /** … … 54 54 * @} */ 55 55 56 #endif /* _TR_L DS_H */56 #endif /* _TR_LPD_H */ 57 57 -
trunk/libtransmission/transmission.h
r10613 r10635 165 165 #define TR_PREFS_KEY_BLOCKLIST_ENABLED "blocklist-enabled" 166 166 #define TR_PREFS_KEY_DHT_ENABLED "dht-enabled" 167 #define TR_PREFS_KEY_L DS_ENABLED "lds-enabled"167 #define TR_PREFS_KEY_LPD_ENABLED "lpd-enabled" 168 168 #define TR_PREFS_KEY_DOWNLOAD_DIR "download-dir" 169 169 #define TR_PREFS_KEY_ENCRYPTION "encryption" … … 593 593 void tr_sessionSetDHTEnabled( tr_session * session, tr_bool ); 594 594 595 tr_bool tr_sessionIsL DSEnabled( const tr_session * session );596 597 void tr_sessionSetL DSEnabled( tr_session * session, tr_bool enabled );595 tr_bool tr_sessionIsLPDEnabled( const tr_session * session ); 596 597 void tr_sessionSetLPDEnabled( tr_session * session, tr_bool enabled ); 598 598 599 599 void tr_sessionSetLazyBitfieldEnabled( tr_session * session, … … 1654 1654 { 1655 1655 TR_PEER_FROM_INCOMING = 0, /* connections made to the listening port */ 1656 TR_PEER_FROM_L DS, /* peers discovered by local announcements */1656 TR_PEER_FROM_LPD, /* peers discovered by local announcements */ 1657 1657 TR_PEER_FROM_TRACKER, /* peers received from a tracker */ 1658 1658 TR_PEER_FROM_DHT, /* peers learnt from the DHT */ -
trunk/qt/prefs-dialog.cc
r10632 r10635 478 478 hig->addWideControl( w = checkBoxNew( tr( "Use &DHT to find more peers" ), Prefs::DHT_ENABLED ) ); 479 479 w->setToolTip( tr( "DHT is a tool for finding peers without a tracker." ) ); 480 hig->addWideControl( w = checkBoxNew( tr( "Use &L DS to find local peers" ), Prefs::LDS_ENABLED ) );481 w->setToolTip( tr( "L DSis 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." ) ); 482 482 483 483 hig->finish( ); -
trunk/qt/prefs.cc
r10611 r10635 94 94 { PEX_ENABLED, TR_PREFS_KEY_PEX_ENABLED, QVariant::Bool }, 95 95 { DHT_ENABLED, TR_PREFS_KEY_DHT_ENABLED, QVariant::Bool }, 96 { L DS_ENABLED, TR_PREFS_KEY_LDS_ENABLED, QVariant::Bool },96 { LPD_ENABLED, TR_PREFS_KEY_LPD_ENABLED, QVariant::Bool }, 97 97 { PORT_FORWARDING, TR_PREFS_KEY_PORT_FORWARDING, QVariant::Bool }, 98 98 { PROXY_AUTH_ENABLED, TR_PREFS_KEY_PROXY_AUTH_ENABLED, QVariant::Bool }, -
trunk/qt/prefs.h
r10611 r10635 98 98 PEX_ENABLED, 99 99 DHT_ENABLED, 100 L DS_ENABLED,100 LPD_ENABLED, 101 101 PORT_FORWARDING, 102 102 PROXY_AUTH_ENABLED, -
trunk/qt/session.cc
r10631 r10635 142 142 case Prefs :: INCOMPLETE_DIR: 143 143 case Prefs :: INCOMPLETE_DIR_ENABLED: 144 case Prefs :: L DS_ENABLED:144 case Prefs :: LPD_ENABLED: 145 145 case Prefs :: PEER_LIMIT_GLOBAL: 146 146 case Prefs :: PEER_LIMIT_TORRENT:
Note: See TracChangeset
for help on using the changeset viewer.