diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/lumaserv/bgp/BGPSession.java | 11 |
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(); } |