Example #1
0
 public NODE(string ID)
 {
     WebsocketConnections = new List <WSConnection>();
     UDPConnections       = new List <UDPConnection>();
     System.Timers.Timer timer = new System.Timers.Timer();
     ttl = LIFELIMIT;
     InitTimer();
     IsActive = true;
     HandleNodeCreated?.Invoke(this);
 }
Example #2
0
        public void AddNode(NODE node)
        {
            RWLock_ClientList.EnterWriteLock();

            try
            {
                nodes.Add(node);
                node.HandleNodeClosed = new Action <NODE>((id => { nodes.Remove(id); }));
            }
            finally
            {
                RWLock_ClientList.ExitWriteLock();
                //调用外部回调函数通知新连接建立
                HandleNodeCreated?.Invoke(this, node);
            }
        }