From 27bcce628c4f9b0e3bd163ab6a826d9d16d98aec Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 13 May 2009 19:58:04 +0000 Subject: [PATCH] (trunk daemon) add --paused argument to pause all on startup --- daemon/daemon.c | 10 ++++++++-- daemon/transmission-daemon.1 | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/daemon/daemon.c b/daemon/daemon.c index 5369eecf5..d9e893556 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -38,7 +38,7 @@ #define PREF_KEY_DIR_WATCH "watch-dir" #define PREF_KEY_DIR_WATCH_ENABLED "watch-dir-enabled" - +static tr_bool paused = FALSE; static tr_bool closing = FALSE; static tr_session * mySession = NULL; @@ -76,6 +76,7 @@ static const struct tr_option options[] = { 'v', "password", "Set password for authentication", "v", 1, "" }, { 'V', "version", "Show version number and exit", "V", 0, NULL }, { 'w', "download-dir", "Where to save downloaded data", "w", 1, "" }, + { 800, "paused", "Pause all torrents on startup", NULL, 0, NULL }, { 'P', "peerport", "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "P", 1, "" }, { 'm', "portmap", "Enable portmapping via NAT-PMP or UPnP", "m", 0, NULL }, { 'M', "no-portmap", "Disable portmapping", "M", 0, NULL }, @@ -273,6 +274,8 @@ main( int argc, char ** argv ) break; case 'l': tr_bencDictAddInt( &settings, TR_PREFS_KEY_PEER_LIMIT_TORRENT, atoi( optarg ) ); break; + case 800: paused = TRUE; + break; case 910: tr_bencDictAddInt( &settings, TR_PREFS_KEY_ENCRYPTION, TR_ENCRYPTION_REQUIRED ); break; case 911: tr_bencDictAddInt( &settings, TR_PREFS_KEY_ENCRYPTION, TR_ENCRYPTION_PREFERRED ); @@ -333,8 +336,11 @@ main( int argc, char ** argv ) /* load the torrents */ { + tr_torrent ** torrents; tr_ctor * ctor = tr_ctorNew( mySession ); - tr_torrent ** torrents = tr_sessionLoadTorrents( mySession, ctor, NULL ); + if( paused ) + tr_ctorSetPaused( ctor, TR_FORCE, TRUE ); + torrents = tr_sessionLoadTorrents( mySession, ctor, NULL ); tr_free( torrents ); tr_ctorFree( ctor ); } diff --git a/daemon/transmission-daemon.1 b/daemon/transmission-daemon.1 index 971e0aff7..e9427fda2 100644 --- a/daemon/transmission-daemon.1 +++ b/daemon/transmission-daemon.1 @@ -81,6 +81,9 @@ Listen for IPv6 BitTorrent connections on a specific address. Only one IPv6 list .It Fl r Fl -rpc-bind-address Listen for RPC connections on a specific address. This must be an IPv4 address. Only one RPC listening address is allowed. Default: 0.0.0.0 (All addresses) +.It Fl -paused +Pause all torrents on startup + .It Fl L Fl -peerlimit-global Ar limit Overall peer limit. Useful on embedded systems where the default might be unsuitable. Default: 240 .It Fl l Fl -peerlimit-torrent Ar limit