Ejemplo n.º 1
0
 public void Connect(Node node)
 {
         Runner.DebugMessage("Debug.Info.Connect", "Trying to connect to: " + node.ToString());
         node.Connect();
 }
Ejemplo n.º 2
0
        public int Connect(Node node)
        {
            IConnection conn = new Native1();
            conn.Connector = this;
            IPAddress ip;
            IPEndPoint ep;
            conn.Node = node;
            IPAddress.TryParse(this.Host, out ip);
            ep = new IPEndPoint(ip, this.Port);
            this.ConnectSocket = this.createsock();
            conn.Socket = this.ConnectSocket;
            int retval;
            try
            {
                this.ConnectSocket.Connect(ep);
                int authval = conn.Auth();
                if (authval == 0)
                {
                    conn.Connect = true;
                    lock (node.Connections)
                    {
                        node.Connections.Add(conn);
                    }
                    retval = 0;
                    return retval;
                }
                else
                {
                    return authval;
                }

            }
            catch
            {
                retval = 2;
            }
            return retval;
        }
Ejemplo n.º 3
0
 private Node NodeInit(string UUID)
 {
     Node scratch;
     if (this.NodeList.ContainsKey(UUID) == true)
     {
         scratch = this.NodeList[UUID];
     }
     else
     {
         scratch = new Node();
         scratch.UUID = UUID;
         this.NodeList.Add(UUID, scratch);
     }
     return scratch;
 }