예제 #1
0
파일: NodesList.cs 프로젝트: Nucs/nlib
 /// <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);
         }
 }
예제 #2
0
파일: Nodes.cs 프로젝트: Nucs/nlib
        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 {}
        }