Exemplo n.º 1
0
 internal static void RemoveSession(Session pSession)
 {
     mSessions.Remove(pSession);
 }
Exemplo n.º 2
0
        //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);
        }