Commit 0cb17b8d authored by canel_q's avatar canel_q

Allow wildcard in route definition

parent 43986bc6
Pipeline #7 passed with stage
in 1 minute and 36 seconds
......@@ -102,6 +102,7 @@ public class Main {
}
}
router.startSystem();
while (true) {
try {
......
......@@ -59,6 +59,17 @@ public class Router {
}
public void startSystem() {
if (routes.containsKey("*")) {
for (IOModule module : routes.get("*")) {
for (String route : routes.keySet()) {
if (!route.equals("*")) {
log.info("Ignoring module " + module.getName() + " on route for packet " + route
+ " cause it is in * route");
routes.get(route).remove(module);
}
}
}
}
log.info("Started servers !");
}
......@@ -84,9 +95,9 @@ public class Router {
if ((newId > lastId) || (newId < lastId - 10)) {
lastPacketId.put(pa, newId);
for (String rn : routes.keySet()) {
if (rn.equals(newApn)) {
if (rn.equals(newApn) || rn.equals("*")) {
ArrayList<IOModule> r = routes.get(rn);
for (IOModule ioModule : r) {
ioModule.sendPacket(pp);
......@@ -98,7 +109,6 @@ public class Router {
log.warn("Repeated packet for node " + pp.getNodeId() + ". packet NOT routed.");
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment