public CPeers(int NumConnections, int Reserved) { mPeers = new CPeer[NumConnections]; mNumReserved = Reserved; instance = this; }
public void InitializePeersList(List <CPeer> peers) { if (Program.DEBUG) { CIO.DebugOut("Initialize mPeers..."); } mPeers = new CPeers(MAX_PEERS, RESERVED_CONNECTION); 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(500)) { if (!mPeers.Insert(p)) { break; } } } if (Program.DEBUG) { CIO.DebugOut("Begin to enstablish connections to other peers..."); } mThreadUpdatePeers = new Thread(new ThreadStart(UpdatePeersList)); mThreadUpdatePeers.Name = "mUpdatePeers"; mThreadUpdatePeers.Start(); if (Program.DEBUG) { CIO.DebugOut("Start listening..."); } mThreadListener = new Thread(new ThreadStart(StartAcceptUsersConnection)); mThreadListener.Name = "Listener"; mThreadListener.Start(); }