示例#1
0
文件: Manager.cs 项目: BjkGkh/R106
 internal static void RemoveSession(Session pSession)
 {
     mSessions.Remove(pSession);
 }
示例#2
0
文件: Manager.cs 项目: BjkGkh/R106
        //private static void performanceThreadCycle()
        //{
        //    PerformanceCounter myCounter = new PerformanceCounter();
        //    myCounter.CategoryName = "PhysicalDisk";
        //    myCounter.CounterName = "Current Disk Queue Length";
        //    myCounter.InstanceName = "_Total";
        //    Random rnd = new Random();

        //    while (true)
        //    {
        //        try
        //        {
        //            long queueLength = myCounter.RawValue;
        //            lock (mSessions)
        //            {
        //                foreach (Session session in mSessions)
        //                {
        //                    session.SendMessage("performance:" + queueLength);
        //                }
        //            }
        //        }
        //        catch (ThreadAbortException) { }
        //        catch (Exception e) { Console.WriteLine(e.ToString()); }
        //        Thread.Sleep(1000);
        //    }
        //}

        internal static void RegisterSession(Session pSession)
        {
            if (!mSessions.Contains(pSession))
                mSessions.Add(pSession);
        }