From 6ed329db787ffeefc67099765d4caa48e619d4a0 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Sat, 12 Nov 2016 18:07:20 +0000
Subject: [PATCH] I2CP: Reduce log level of error when session closed while
 signing leaseset (ticket #1606)

---
 .../client/impl/RequestLeaseSetMessageHandler.java   | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/core/java/src/net/i2p/client/impl/RequestLeaseSetMessageHandler.java b/core/java/src/net/i2p/client/impl/RequestLeaseSetMessageHandler.java
index 09dab72ff4..809492c4cc 100644
--- a/core/java/src/net/i2p/client/impl/RequestLeaseSetMessageHandler.java
+++ b/core/java/src/net/i2p/client/impl/RequestLeaseSetMessageHandler.java
@@ -9,6 +9,7 @@ package net.i2p.client.impl;
  *
  */
 
+import java.io.EOFException;
 import java.security.GeneralSecurityException;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -185,7 +186,16 @@ class RequestLeaseSetMessageHandler extends HandlerImpl {
         } catch (DataFormatException dfe) {
             session.propogateError("Error signing the leaseSet", dfe);
         } catch (I2PSessionException ise) {
-            session.propogateError("Error sending the signed leaseSet", ise);
+            if (session.isClosed()) {
+                // race, closed while signing leaseset
+                // EOFExceptions are logged at WARN level (see I2PSessionImpl.propogateError())
+                // so the user won't see this
+                EOFException eof = new EOFException("Session closed while signing leaseset");
+                eof.initCause(ise);
+                session.propogateError("Session closed while signing leaseset", eof);
+            } else {
+                session.propogateError("Error sending the signed leaseSet", ise);
+            }
         }
     }
 
-- 
GitLab