Brunet.Connections.CtmRequestHandler.GetCtmResponseTo C# (CSharp) Метод

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

protected GetCtmResponseTo ( ConnectToMessage ctm_req ) : ConnectToMessage
ctm_req ConnectToMessage
Результат ConnectToMessage
    protected ConnectToMessage GetCtmResponseTo(ConnectToMessage ctm_req) {
      NodeInfo target = ctm_req.Target;
      
      //Send the 4 neighbors closest to this node:
      ArrayList nearest = _n.ConnectionTable.GetNearestTo( (AHAddress)target.Address, 4);
      //Now get these the NodeInfo objects for these:
      ArrayList neighbors = new ArrayList();
      foreach(Connection cons in nearest) {
        //No need to send the TA, since only the address is used
        NodeInfo neigh = NodeInfo.CreateInstance(cons.Address);
        neighbors.Add( neigh );
      }
      //Put these into an NodeInfo[]
      NodeInfo[] neigh_array = new NodeInfo[ neighbors.Count ];
      for(int i = 0; i < neighbors.Count; i++) {
        neigh_array[i] = (NodeInfo)neighbors[i];
      }
      return new ConnectToMessage(ctm_req.ConnectionType, _n.GetNodeInfo(12), neigh_array, ctm_req.Token);
    }
  }