Brunet.Relay.RelayEdgeListener.AttemptToCreateOverlap C# (CSharp) Метод

AttemptToCreateOverlap() защищенный Метод

First we try to find a third party we can connect with for overlap, if that is successful, we attempt to connect to him, if that is successful, we create a new tunnel edge.
protected AttemptToCreateOverlap ( RelayEdgeCallbackAction teca ) : void
teca RelayEdgeCallbackAction
Результат void
    protected void AttemptToCreateOverlap(RelayEdgeCallbackAction teca)
    {
      WaitCallback create_connection = delegate(object o) {
        Address target = o as Address;
        if(o == null) {
          FailedEdgeCreate(teca);
          return;
        }

        ConnectionList cons = _connections;
        int index = cons.IndexOf(target);
        if(index < 0) {
          FailedEdgeCreate(teca);
          return;
        }

        List<Connection> overlap = new List<Connection>(1);
        overlap.Add(cons[index]);
        CreateEdge(teca, overlap);
      };

      Channel chan = new Channel(1);
      chan.CloseEvent += delegate(object o, EventArgs ea) {
        Address target = null;
        try {
          IDictionary msg = (chan.Dequeue() as RpcResult).Result as IDictionary;
          target = _ito.EvaluatePotentialOverlap(msg);
        } catch {
        }

        if(target == null) {
          FailedEdgeCreate(teca);
        } else {
          _oco.ConnectTo(target, create_connection);
        }
      };

      ISender s = new AHExactSender(_node, teca.RelayTA.Target);
      try { _node.Rpc.Invoke(s, chan, "tunnel.RequestSync"); }
      catch { chan.Close(); }
    }