summaryrefslogtreecommitdiff
path: root/src/main/java/com/lumaserv/bgp/BGPServer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/BGPServer.java')
-rw-r--r--src/main/java/com/lumaserv/bgp/BGPServer.java15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/main/java/com/lumaserv/bgp/BGPServer.java b/src/main/java/com/lumaserv/bgp/BGPServer.java
index e95caea..78ceee8 100644
--- a/src/main/java/com/lumaserv/bgp/BGPServer.java
+++ b/src/main/java/com/lumaserv/bgp/BGPServer.java
@@ -99,6 +99,7 @@ public class BGPServer implements Runnable {
}
sessions.remove(otherSession);
otherSession.dropConnection();
+ otherSession.cleanup();
// Accept new connection
return false;
} else {
@@ -128,12 +129,9 @@ public class BGPServer implements Runnable {
continue;
}
- BGPFsm fsm = new BGPFsm();
- BGPSession session = new BGPSession(this, socket, config, fsm);
- fsm.setSession(session);
+ BGPSession session = new BGPSession(this, socket, config);
sessions.add(session);
- System.out.println("automaticStartPassive");
- fsm.getCurrentState().automaticStartPassive();
+ session.getFsm().getCurrentState().automaticStartPassive();
// System.out.println("tcpConnectionConfirmed in " + fsm.getCurrentState());
// fsm.getCurrentState().tcpConnectionConfirmed();
@@ -158,11 +156,9 @@ public class BGPServer implements Runnable {
}
try {
- BGPFsm fsm = new BGPFsm();
- BGPSession session = new BGPSession(this, config, fsm, host, port);
- fsm.setSession(session);
+ BGPSession session = new BGPSession(this, config, host, port);
sessions.add(session);
- fsm.getCurrentState().automaticStart();
+ session.getFsm().getCurrentState().automaticStart();
return true;
} catch (IOException ex) {
ex.printStackTrace();
@@ -173,6 +169,7 @@ public class BGPServer implements Runnable {
public void shutdown() {
for(BGPSession session : sessions) {
session.automaticStop();
+ session.cleanup();
}
sessions.clear();
if (serverSocket != null) {