summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();