diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2022-01-31 23:16:31 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-11-13 00:17:57 +0100 |
commit | 88f43944c915be3cb824a8ffa4f2995666b73486 (patch) | |
tree | f38d9c2b7fede5ec46e8df042afa36ce66819110 /src/main/java/com/lumaserv/bgp/BGPSession.java | |
parent | 9f35136d97673b825fb51c2e1c7067881a3d6820 (diff) |
Implent outgoing BGPUpdate and some attributes
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/BGPSession.java')
-rw-r--r-- | src/main/java/com/lumaserv/bgp/BGPSession.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/com/lumaserv/bgp/BGPSession.java b/src/main/java/com/lumaserv/bgp/BGPSession.java index 3ffadd8..f693f11 100644 --- a/src/main/java/com/lumaserv/bgp/BGPSession.java +++ b/src/main/java/com/lumaserv/bgp/BGPSession.java @@ -27,7 +27,7 @@ public class BGPSession implements Runnable { public void keepAlive() { try { - outputStream.write(new BGPPacket().setType(BGPPacket.Type.KEEPALIVE).setMessage(new byte[0]).build()); + outputStream.write(new BGPPacket().setType(BGPPacket.Type.KEEPALIVE).build()); } catch (IOException e) { e.printStackTrace(); } @@ -43,12 +43,21 @@ public class BGPSession implements Runnable { keepAlive(); break; case UPDATE: { - configuration.getListener().onUpdate(this, new BGPUpdate(packet.getMessage())); + configuration.getListener().onUpdate(this, (BGPUpdate)packet.getMessage()); break; } } } + public void send(BGPPacket packet) { + try { + outputStream.write(packet.build()); + } catch (IOException ex) { + closed = true; + configuration.getListener().onClose(this); + } + } + public void run() { try { while (!closed) { |