From c732c1c038a9cbeed251e92378e237d243f476c0 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Thu, 24 Oct 2013 20:56:37 +0000
Subject: [PATCH] I2PTunnel: Catch unchecked exceptions in server accept loop
 (ticket #1070)

---
 .../java/src/net/i2p/i2ptunnel/I2PTunnelServer.java    | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java
index 9203f58d17..e8112ad185 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java
@@ -449,10 +449,18 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
                     _log.error("Error accepting", ce);
                 // not killing the server..
                 try {
-                    Thread.currentThread().sleep(500);
+                    Thread.sleep(500);
                 } catch (InterruptedException ie) {}
             } catch(SocketTimeoutException ste) {
                 // ignored, we never set the timeout
+            } catch (Exception e) {
+                // streaming borkage
+                if (_log.shouldLog(Log.ERROR))
+                    _log.error("Uncaught exception accepting", e);
+                // not killing the server..
+                try {
+                    Thread.sleep(500);
+                } catch (InterruptedException ie) {}
             }
         }
         if (_executor != null)
-- 
GitLab