diff options
author | JanHolger <jan@bebendorf.eu> | 2021-11-30 21:08:47 +0100 |
---|---|---|
committer | JanHolger <jan@bebendorf.eu> | 2021-11-30 21:08:47 +0100 |
commit | 7498460d25ccae73b717f43653778624ce0daed0 (patch) | |
tree | e92b90d5d81c4be4594eae2ff59ce342883cef9e /src/main/java/com/lumaserv/bgp/BGPSession.java | |
parent | 4912be906f7663960474a34a3ba04c6c227dc91a (diff) |
Fixed a few issues
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/BGPSession.java')
-rw-r--r-- | src/main/java/com/lumaserv/bgp/BGPSession.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/com/lumaserv/bgp/BGPSession.java b/src/main/java/com/lumaserv/bgp/BGPSession.java index de1fc66..1d40f9d 100644 --- a/src/main/java/com/lumaserv/bgp/BGPSession.java +++ b/src/main/java/com/lumaserv/bgp/BGPSession.java @@ -15,6 +15,8 @@ public class BGPSession implements Runnable { final BGPSessionConfiguration configuration; final InputStream inputStream; final OutputStream outputStream; + @Getter + boolean closed; public BGPSession(Socket socket, BGPSessionConfiguration configuration) throws IOException { this.configuration = configuration; @@ -32,6 +34,10 @@ public class BGPSession implements Runnable { private void handle(BGPPacket packet) { switch (packet.getType()) { + case NOTIFICATION: + closed = true; + configuration.getListener().onClose(this); + break; case KEEPALIVE: keepAlive(); break; @@ -44,7 +50,7 @@ public class BGPSession implements Runnable { public void run() { try { - while (true) + while (!closed) handle(BGPPacket.read(inputStream)); } catch (IOException ex) { ex.printStackTrace(); |