Skip to content

Commit ef92ccf

Browse files
Query Router Data from the Flow Table
1 parent 13ee254 commit ef92ccf

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

Server/src/Switcher.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ Switcher.on('message', (msg, rinfo) => {
3636

3737
let sendMessage: any;
3838
let messageType: number = -1;
39-
let routerId: string;
39+
let previousRouterId: String;
40+
let routerId: String;
4041

4142
switch (type) {
4243

@@ -46,6 +47,15 @@ Switcher.on('message', (msg, rinfo) => {
4647

4748
// Assign ID to Router and add to Router List
4849
routerId = `R${++routerCount}`;
50+
51+
// Update Current Router details in Flow Table
52+
let currentFlowTable = FlowTable.get(routerId);
53+
if (currentFlowTable) {
54+
currentFlowTable[2] = address.toString();
55+
currentFlowTable[3] = port.toString();
56+
}
57+
58+
// Add Router to list of active connections
4959
Routers.add(newClient({ address, port, routerId }));
5060
sendMessage = { routerId, message: "New Router", address, port };
5161
messageType = 0;

0 commit comments

Comments
 (0)