Ejemplo n.º 1
0
 public async void Start()
 {
     if (Interlocked.Exchange(ref started, 1) == 0)
     {
         connectWorker.Start();
         listener.Start();
         while (disposed == 0)
         {
             TcpClient tcp;
             try
             {
                 tcp = await listener.AcceptTcpClientAsync();
             }
             catch (ObjectDisposedException)
             {
                 continue;
             }
             RemoteNode remoteNode = new RemoteNode(this, tcp);
             lock (pendingPeers)
             {
                 pendingPeers.Add(remoteNode);
             }
             remoteNode.StartProtocolAsync().Void();
         }
     }
 }