From 911f599ca032a13fdb24ff543e53fff7ed6a2a82 Mon Sep 17 00:00:00 2001 From: CyB3RC0nN0R Date: Sat, 25 Jul 2020 15:09:00 +0200 Subject: [PATCH] Prevent Receiver from looping after connection loss --- client/src/main/java/envoy/client/net/Receiver.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/client/src/main/java/envoy/client/net/Receiver.java b/client/src/main/java/envoy/client/net/Receiver.java index e325c4f..fdfa1e8 100644 --- a/client/src/main/java/envoy/client/net/Receiver.java +++ b/client/src/main/java/envoy/client/net/Receiver.java @@ -1,8 +1,6 @@ package envoy.client.net; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.ObjectInputStream; +import java.io.*; import java.net.SocketException; import java.util.HashMap; import java.util.Map; @@ -82,8 +80,9 @@ public class Receiver extends Thread { logger.log(Level.WARNING, String.format("The received object has the %s for which no processor is defined.", obj.getClass())); else processor.accept(obj); } - } catch (final SocketException e) { + } catch (final SocketException | EOFException e) { // Connection probably closed by client. + logger.log(Level.FINER, "Exiting receiver..."); return; } catch (final Exception e) { logger.log(Level.SEVERE, "Error on receiver thread", e);