diff options
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/BGPFsm.java')
-rw-r--r-- | src/main/java/com/lumaserv/bgp/BGPFsm.java | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/main/java/com/lumaserv/bgp/BGPFsm.java b/src/main/java/com/lumaserv/bgp/BGPFsm.java index a2143bd..7929d36 100644 --- a/src/main/java/com/lumaserv/bgp/BGPFsm.java +++ b/src/main/java/com/lumaserv/bgp/BGPFsm.java @@ -244,6 +244,36 @@ public class BGPFsm { } class OpenSent extends State { + protected void stop(boolean isAutomatic) { + try { + BGPNotification notification = new BGPNotification() + .setMajorErrorCode(BGPNotification.Error.CEASE.getCode()); + session.sendNotification(notification); + } catch (IOException ex) { + } + setConnectRetryTimer(0); + // - releases all the BGP resources, + session.dropConnection(); + if (isAutomatic) { + connectRetryCounter++; + // - (optionally) performs peer oscillation damping if the + // DampPeerOscillations attribute is set to TRUE, and + } else { + connectRetryCounter = 0; + } + setState(IDLE); + } + + @Override + void manualStop() { + stop(false); + } + + @Override + void automaticStop() { + stop(true); + } + @Override void openMsg(BGPOpen msg) { System.out.println("openMsg:" + msg); @@ -311,6 +341,37 @@ public class BGPFsm { } class Established extends State { + protected void stop(boolean isAutomatic) { + try { + BGPNotification notification = new BGPNotification() + .setMajorErrorCode(BGPNotification.Error.CEASE.getCode()); + session.sendNotification(notification); + } catch (IOException ex) { + } + setConnectRetryTimer(0); + // - deletes all routes associated with this connection, + // - releases all BGP resources, + session.dropConnection(); + if (isAutomatic) { + connectRetryCounter++; + // - (optionally in automaticStop) performs peer oscillation damping if the + // DampPeerOscillations attribute is set to TRUE, and + } else { + connectRetryCounter = 0; + } + setState(IDLE); + } + + @Override + void manualStop() { + stop(false); + } + + @Override + void automaticStop() { + stop(true); + } + @Override void keepAliveMsg() { setHoldTimer(holdTime); |