Inheritance: IDisposable
        public static bool EnableTimer(this IOHandler ioHandler, uint seconds)
        {
            var timerEvent = new TimerEvent {
                Id = ioHandler.Id, Period = seconds
            };

            TimersManager.AddTimer(timerEvent);
            return(true);
        }
 public static void RegisterIOHandler(this IOHandler pIoHandler)
 {
     if (ActiveIoHandler.ContainsKey(pIoHandler.Id))
     {
         Logger.ASSERT("IOHandler already registered");
     }
     ActiveIoHandler[pIoHandler.Id] = pIoHandler;
     Logger.Debug("Handlers count changed: {0}->{1}", ActiveIoHandler.Keys.Count - 1, ActiveIoHandler.Keys.Count);
 }
 public static void EnqueueForDelete(IOHandler ioHandler)
 {
     ioHandler.WriteEnabled  = false;
     ioHandler.ReadEnabled   = false;
     ioHandler.AcceptEnabled = false;
     ioHandler.DisableTimer();
     ioHandler.Dispose();
     //DeadIoHandler.AddLast(ioHandler);
 }
 public static void UnRegisterIOHandler(this IOHandler pIoHandler)
 {
     pIoHandler.WriteEnabled  = false;
     pIoHandler.ReadEnabled   = false;
     pIoHandler.AcceptEnabled = false;
     pIoHandler.DisableTimer();
     ActiveIoHandler.Remove(pIoHandler.Id);
     Logger.Debug("Handlers count changed: {0}->{1}", ActiveIoHandler.Keys.Count + 1, ActiveIoHandler.Keys.Count);
 }
        public static SocketAsyncEventArgs CreateOrGetSocketAsyncEventArgs(this IOHandler ioHandler)
        {
            SocketAsyncEventArgs saea;

            if (!GlobalPool <SocketAsyncEventArgs> .GetObject(out saea))
            {
                saea.Completed += saeCompleted;
            }
            saea.UserToken = ioHandler;
            return(saea);
        }
 public static bool DisableTimer(this IOHandler ioHandler)
 {
     TimersManager.RemoveTimer(ioHandler.Id);
     return(true);
 }
Esempio n. 7
0
 public static void EnqueueForDelete(IOHandler ioHandler)
 {
     ioHandler.WriteEnabled = false;
     ioHandler.ReadEnabled = false;
     ioHandler.AcceptEnabled = false;
     ioHandler.DisableTimer();
     ioHandler.Dispose();
     //DeadIoHandler.AddLast(ioHandler);
 }