(FtnMessage message, Link previousRouteVia)
| 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); |
no test coverage detected