Package com.subgraph.orchid

Examples of com.subgraph.orchid.ExitCircuit


    final CircuitFilter filter = new CircuitFilter() {
      public boolean filter(Circuit circuit) {
        if(!(circuit instanceof ExitCircuit)) {
          return false;
        }
        final ExitCircuit ec = (ExitCircuit) circuit;
        final boolean pendingOrConnected = circuit.isPending() || circuit.isConnected();
        final boolean isCleanIfNeeded = !(needClean && !circuit.isClean());
        return pendingOrConnected && isCleanIfNeeded && ec.canHandleExitTo(target);
      }
    };
    return circuitManager.getCircuitsByFilter(filter).size();
  }
View Full Code Here


  private void circuitOpenedHandler(Circuit circuit) {
    if(!(circuit instanceof ExitCircuit)) {
      return;
    }
    final ExitCircuit ec = (ExitCircuit) circuit;
    final List<StreamExitRequest> pendingExitStreams = circuitManager.getPendingExitStreams();
    for(StreamExitRequest req: pendingExitStreams) {
      if(ec.canHandleExitTo(req) && req.reserveRequest()) {
        launchExitStreamTask(ec, req);
      }
    }
  }
View Full Code Here

        ac.add((ExitCircuit) c);
      }
    }
    final int sz = ac.size();
    for(int i = 0; i < sz; i++) {
      final ExitCircuit tmp = ac.get(i);
      final int swapIdx = random.nextInt(sz);
      ac.set(i, ac.get(swapIdx));
      ac.set(swapIdx, tmp);
    }
    return ac;
View Full Code Here

    }
    return circuit;
  }

  public ExitCircuit openExitCircuitTo(List<Router> paththrows OpenFailedException {
    final ExitCircuit circuit = CircuitImpl.createExitCircuitTo(this, path);
    if(!tryOpenCircuit(circuit, false, false)) {
      throw new OpenFailedException("Could not create exit circuit for path");
    }
    return circuit;
  }
View Full Code Here

TOP

Related Classes of com.subgraph.orchid.ExitCircuit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.