diff options
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/BGPServer.java')
-rw-r--r-- | src/main/java/com/lumaserv/bgp/BGPServer.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/com/lumaserv/bgp/BGPServer.java b/src/main/java/com/lumaserv/bgp/BGPServer.java index 695ef96..80ec7ff 100644 --- a/src/main/java/com/lumaserv/bgp/BGPServer.java +++ b/src/main/java/com/lumaserv/bgp/BGPServer.java @@ -15,6 +15,7 @@ public class BGPServer implements Runnable { final ServerSocket serverSocket; @Getter final List<BGPSessionConfiguration> sessionConfigurations = new ArrayList<>(); + final List<BGPSession> sessions = new ArrayList<>(); public BGPServer() throws IOException { this(179); @@ -58,6 +59,7 @@ public class BGPServer implements Runnable { BGPFsm fsm = new BGPFsm(); BGPSession session = new BGPSession(socket, config, fsm); fsm.setSession(session); + sessions.add(session); System.out.println("automaticStartPassive"); fsm.getCurrentState().automaticStartPassive(); @@ -78,6 +80,7 @@ public class BGPServer implements Runnable { BGPFsm fsm = new BGPFsm(); BGPSession session = new BGPSession(config, fsm, host, port); fsm.setSession(session); + sessions.add(session); fsm.getCurrentState().automaticStart(); return true; } catch (IOException ex) { @@ -85,4 +88,10 @@ public class BGPServer implements Runnable { throw(ex); } } + + public void shutdown() { + for(BGPSession session : sessions) { + session.automaticStop(); + } + } } |