From 39ba4b21731c5791af749e420dea1c86c1f2d5d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mads=20Bj=C3=B8rn?= <mads12bjoern@gmail.com> Date: Tue, 7 Jan 2020 17:46:57 +0100 Subject: [PATCH] Added a catch for the socketExceptions we see on Infinite Loop Of Errors --- .../main/java/org/jspace/gate/KeepClientHandler.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/org/jspace/gate/KeepClientHandler.java b/common/src/main/java/org/jspace/gate/KeepClientHandler.java index 2006be7..484ec6c 100644 --- a/common/src/main/java/org/jspace/gate/KeepClientHandler.java +++ b/common/src/main/java/org/jspace/gate/KeepClientHandler.java @@ -29,6 +29,7 @@ import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.Socket; +import java.net.SocketException; import org.jspace.io.jSpaceMarshaller; import org.jspace.protocol.ClientMessage; @@ -59,7 +60,12 @@ public KeepClientHandler(jSpaceMarshaller marshaller, Socket client) throws IOEx */ @Override public ClientMessage receive() throws IOException { - ClientMessage message = marshaller.read(ClientMessage.class, reader); + ClientMessage message = null; + try { + message = marshaller.read(ClientMessage.class, reader); + } catch (SocketException e) { + // It's okay, just below we will set isActive to false, since the message is null + } isActive = (message != null); return message; } @@ -96,5 +102,7 @@ public boolean isClosed() { return isClosed; } - + } + +