summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-11-10 23:01:45 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-11-12 17:40:46 +0100
commit5331d79ac26bfef6a3141c26cafcd1ed40d7e7df (patch)
treed6f7768fa654f2dfd44028ca905b3faee28a3562
parent8f07e17d9263ebcbb4766edec3d62797f6f13550 (diff)
Allow automatic stop in Connected state
-rw-r--r--src/main/java/com/lumaserv/bgp/BGPFsm.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/main/java/com/lumaserv/bgp/BGPFsm.java b/src/main/java/com/lumaserv/bgp/BGPFsm.java
index 7c5b6aa..fbf1528 100644
--- a/src/main/java/com/lumaserv/bgp/BGPFsm.java
+++ b/src/main/java/com/lumaserv/bgp/BGPFsm.java
@@ -147,16 +147,31 @@ public class BGPFsm implements Callback {
class Connect extends State {
// TODO ignore start events 1, 3-7
- @Override
- void manualStop() {
+ protected void stop(boolean isAutomatic) {
session.dropConnection();
// - releases all BGP resources,
- connectRetryCounter = 0;
+ if (isAutomatic) {
+ connectRetryCounter++;
+ } else {
+ connectRetryCounter = 0;
+ }
setConnectRetryTimer(0);
setState(IDLE);
}
@Override
+ void manualStop() {
+ stop(false);
+ }
+
+ // AutomaticStop isn't mentioned in the Connect state in RFC 4271,
+ // but it's needed at least in WireGuard.
+ @Override
+ void automaticStop() {
+ stop(true);
+ }
+
+ @Override
void connectRetryTimerExpires() {
System.out.println("connectRetryTimerExpires");
session.dropConnection();