Beispiel #1
0
 /// <summary>
 ///     Inserts the other list into this list.
 /// </summary>
 /// <param name="anotherlist"></param>
 public void MergeInto(NodesList <T> anotherlist)
 {
     lock (_sync)
         foreach (var node in anotherlist.Where(n => n?.IP != null))
         {
             base.Add(node);
         }
 }
Beispiel #2
0
        private void DiscoveryHandler(PacketHeader packetHeader, Connection connection, NodesList <T> nl)
        {
            try {
                KnownNodes.MergeInto(nl);
                connection.SendObject("DiscoverReply", KnownNodes);
#if DEBUG
                var ip = new Node(((IPEndPoint)connection.ConnectionInfo.RemoteEndPoint).Address.ToString());
                //Console.WriteLine($"{ip} has performed handshake");
#endif
            } catch {}
        }