From c20772702a789fe34beb2ceae453fef4549afa42 Mon Sep 17 00:00:00 2001
From: dg2-new <dg2-new@mail.i2p>
Date: Wed, 22 Jul 2015 22:05:44 +0000
Subject: [PATCH] I2PSnark: Don't let tunnels start unless we're starting
 torrents (regression, #766)

---
 apps/i2psnark/java/src/org/klomp/snark/Peer.java         | 2 +-
 apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/apps/i2psnark/java/src/org/klomp/snark/Peer.java b/apps/i2psnark/java/src/org/klomp/snark/Peer.java
index d612ce0275..cba955f691 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/Peer.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/Peer.java
@@ -297,7 +297,7 @@ public class Peer implements Comparable<Peer>
   
         if (_log.shouldLog(Log.DEBUG))
             _log.debug("Start running the reader with " + toString());
-        // Use this thread for running the incomming connection.
+        // Use this thread for running the incoming connection.
         // The outgoing connection creates its own Thread.
         out.startup();
         Thread.currentThread().setName("Snark reader from " + peerID);
diff --git a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java
index 758df140bc..7718218270 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java
@@ -1278,7 +1278,7 @@ public class SnarkManager implements CompleteListener {
             running = true;
         } else {
             running = false;
-        }
+        }        
         // Were we running last time?
         if (!dontAutoStart && shouldAutoStart() && running) {
             torrent.startTorrent();
@@ -2128,7 +2128,7 @@ public class SnarkManager implements CompleteListener {
                 try {
                     // Snark.fatal() throws a RuntimeException
                     // don't let one bad torrent kill the whole loop
-                    addTorrent(name, null, false);
+                    addTorrent(name, null, !shouldAutoStart());
                 } catch (Exception e) {
                     addMessage(_("Error: Could not add the torrent {0}", name) + ": " + e);
                     _log.error("Unable to add the torrent " + name, e);
-- 
GitLab