]> granicus.if.org Git - transmission/commitdiff
(trunk daemon) add --paused argument to pause all on startup
authorCharles Kerr <charles@transmissionbt.com>
Wed, 13 May 2009 19:58:04 +0000 (19:58 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Wed, 13 May 2009 19:58:04 +0000 (19:58 +0000)
daemon/daemon.c
daemon/transmission-daemon.1

index 5369eecf5883a5dcaec7a67c164e0397862739b6..d9e8935567b58b72145357acc7359cb1117d2ea5 100644 (file)
@@ -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, "<password>" },
     { 'V', "version", "Show version number and exit", "V", 0, NULL },
     { 'w', "download-dir", "Where to save downloaded data", "w", 1, "<path>" },
+    { 800, "paused", "Pause all torrents on startup", NULL, 0, NULL },
     { 'P', "peerport", "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "P", 1, "<port>" },
     { '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 );
     }
index 971e0aff74a7a37492ac4215be7dc2a2afd1d7c1..e9427fda2d03385d3a9ab68d9f725080866c6919 100644 (file)
@@ -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