コード例 #1
0
        private void Start(List <CPeer> Peers)
        {
            if (Program.DEBUG)
            {
                CIO.DebugOut("Begin to enstablish connections to initial peers...");
            }
            //si collega ai peer inseriti nella lista iniziale.
            foreach (CPeer p in Peers)
            {
                if (p.Connect())
                {
                    if (!mPeers.Insert(p))
                    {
                        break;
                    }
                }
            }

            if (Program.DEBUG)
            {
                CIO.DebugOut("Begin to enstablish connections to other peers...");
            }
            mThreadPeers = new Thread(new ThreadStart(UpdatePeersList));
            mThreadPeers.Start();

            if (Program.DEBUG)
            {
                CIO.DebugOut("Start listening...");
            }
            mThreadListener = new Thread(new ThreadStart(StartAcceptUsersConnection));
            mThreadListener.Start();

            if (Program.DEBUG)
            {
                CIO.DebugOut("Start update blockchain...");
            }
            mUpdateBlockChainThread = new Thread(new ThreadStart(UpdateBlockchain));
            mUpdateBlockChainThread.Start();
        }