summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorJanHolger <jan@bebendorf.eu>2021-12-01 16:46:48 +0100
committerJanHolger <jan@bebendorf.eu>2021-12-01 16:46:48 +0100
commit1a93ceffb3510c7000ed46ed9ba211f4db70f0ae (patch)
treec6e5584077e14b91be21a599c0aed40c161b2667 /src/main/java
parent7498460d25ccae73b717f43653778624ce0daed0 (diff)
Added proper handling of SocketException's
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/lumaserv/bgp/BGPSession.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/com/lumaserv/bgp/BGPSession.java b/src/main/java/com/lumaserv/bgp/BGPSession.java
index 1d40f9d..669010b 100644
--- a/src/main/java/com/lumaserv/bgp/BGPSession.java
+++ b/src/main/java/com/lumaserv/bgp/BGPSession.java
@@ -8,6 +8,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
+import java.net.SocketException;
public class BGPSession implements Runnable {
@@ -50,8 +51,14 @@ public class BGPSession implements Runnable {
public void run() {
try {
- while (!closed)
- handle(BGPPacket.read(inputStream));
+ while (!closed) {
+ try {
+ handle(BGPPacket.read(inputStream));
+ } catch (SocketException ignored) {
+ closed = true;
+ configuration.getListener().onClose(this);
+ }
+ }
} catch (IOException ex) {
ex.printStackTrace();
}