MCPcopy Create free account
hub / github.com/annmuor/jnode / getRoutingFallback

Method getRoutingFallback

jnode-core/src/jnode/ftn/FtnTools.java:907–930  ·  view source on GitHub ↗
(FtnMessage message,
			Link previousRouteVia)

Source from the content-addressed store, hash-verified

905 }
906
907 public static Link getRoutingFallback(FtnMessage message,
908 Link previousRouteVia) {
909 Link routeVia = null;
910 FtnAddress routeTo = message.getToAddr().clone();
911 if (isOurPoint(routeTo)) {
912 return null;
913 }
914 // direct link can be down for us - use cross way
915 List<Route> routes = ORMManager.get(Route.class).getOrderAnd("nice",
916 true);
917 for (Route route : routes) {
918 if (completeMask(route, message)) {
919 if (route.getRouteVia().equals(previousRouteVia)) {
920 continue;
921 }
922 routeVia = route.getRouteVia();
923 break;
924 }
925 }
926 if (routeVia == null) {
927 routeVia = previousRouteVia;
928 }
929 return getLinkById(routeVia.getId());
930 }
931
932 private static Link getLinkById(Long id) {
933 return ORMManager.get(Link.class).getFirstAnd("id", "=", id);

Callers 1

runMethod · 0.95

Calls 10

isOurPointMethod · 0.95
getMethod · 0.95
completeMaskMethod · 0.95
getLinkByIdMethod · 0.95
getIdMethod · 0.95
cloneMethod · 0.80
getOrderAndMethod · 0.80
getToAddrMethod · 0.45
equalsMethod · 0.45
getRouteViaMethod · 0.45

Tested by

no test coverage detected