From 8d6d1bc7517a6d60e778c58f6b9be177cc41bab0 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Wed, 10 Jan 2018 17:58:50 +0000
Subject: [PATCH] i2psnark: Fix infinite loop stopping update torrent (ticket
 #2125)

---
 apps/i2psnark/java/src/org/klomp/snark/UpdateRunner.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/apps/i2psnark/java/src/org/klomp/snark/UpdateRunner.java b/apps/i2psnark/java/src/org/klomp/snark/UpdateRunner.java
index fca2543179..3c04feea9c 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/UpdateRunner.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/UpdateRunner.java
@@ -186,7 +186,9 @@ class UpdateRunner implements UpdateTask, CompleteListener {
     private void fatal(String error) {
             if (_snark != null) {
                 if (_hasMetaInfo) {
-                    _smgr.stopTorrent(_snark, true);
+                    // avoid loop stopTorrent() ... updateStatus() ... fatal() ...
+                    if (!_snark.isStopped())
+                        _smgr.stopTorrent(_snark, true);
                     String file = _snark.getName();
                     _smgr.removeTorrent(file);
                     // delete torrent file
-- 
GitLab