* @param sourceRouter The UUID of the router pipe that wants to send the stack.
* @param excludeSource Boolean, true means it will not consider the pipe itself as a valid destination.
*/
@Override
public Triplet<Integer, SinkReply, List<IFilter>> hasDestination(ItemIdentifier stack, boolean allowDefault, int sourceID, List<Integer> routerIDsToExclude) {
IRouter sourceRouter = SimpleServiceLocator.routerManager.getRouter(sourceID);
if (sourceRouter == null) return null;
BitSet routersIndex = ServerRouter.getRoutersInterestedIn(stack);
List<ExitRoute> validDestinations = new ArrayList<ExitRoute>(); // get the routing table
for (int i = routersIndex.nextSetBit(0); i >= 0; i = routersIndex.nextSetBit(i+1)) {
IRouter r = SimpleServiceLocator.routerManager.getRouterUnsafe(i,false);
List<ExitRoute> exits = sourceRouter.getDistanceTo(r);
if (exits!=null) {
for(ExitRoute e:exits) {
if(e.containsFlag(PipeRoutingConnectionType.canRouteTo))
validDestinations.add(e);