diff options
author | JanHolger <jan@bebendorf.eu> | 2021-11-30 21:08:47 +0100 |
---|---|---|
committer | JanHolger <jan@bebendorf.eu> | 2021-11-30 21:08:47 +0100 |
commit | 7498460d25ccae73b717f43653778624ce0daed0 (patch) | |
tree | e92b90d5d81c4be4594eae2ff59ce342883cef9e /src/main/java/com/lumaserv/bgp/BGPServer.java | |
parent | 4912be906f7663960474a34a3ba04c6c227dc91a (diff) |
Fixed a few issues
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, 7 insertions, 2 deletions
diff --git a/src/main/java/com/lumaserv/bgp/BGPServer.java b/src/main/java/com/lumaserv/bgp/BGPServer.java index d06f341..b8f934a 100644 --- a/src/main/java/com/lumaserv/bgp/BGPServer.java +++ b/src/main/java/com/lumaserv/bgp/BGPServer.java @@ -17,7 +17,11 @@ public class BGPServer implements Runnable { final List<BGPSessionConfiguration> sessionConfigurations = new ArrayList<>(); public BGPServer() throws IOException { - serverSocket = new ServerSocket(179); + this(179); + } + + public BGPServer(int port) throws IOException { + serverSocket = new ServerSocket(port); } private static boolean checkEqual(byte[] a, byte[] b) { @@ -48,6 +52,8 @@ public class BGPServer implements Runnable { .orElse(null); if(config == null) continue; + BGPSession session = new BGPSession(socket, config); + config.getListener().onOpen(session); BGPOpen response = new BGPOpen() .setAsn(config.getLocalAs()) .setHoldTime(request.getHoldTime()) @@ -58,7 +64,6 @@ public class BGPServer implements Runnable { } catch (IOException e) { e.printStackTrace(); } - BGPSession session = new BGPSession(socket, config); session.keepAlive(); new Thread(session).start(); } catch (IOException ex) { |