Esempio n. 1
0
 internal void FreeMemory()
 {
     try
     {
         List <int> free = new List <int>();
         foreach (var b in _cache)
         {
             if (b.Value.isDirty == false)
             {
                 free.Add(b.Key);
             }
         }
         log.Debug("releasing bmp count = " + free.Count + " out of " + _cache.Count);
         foreach (int i in free)
         {
             _cache.Remove(i);
         }
     }
     catch { }
 }
Esempio n. 2
0
 public void FreeMemory()
 {
     _index.FreeMemory();
     try
     {
         List <int> free = new List <int>();
         foreach (var c in _cache)
         {
             if (c.Value.isDirty == false)
             {
                 free.Add(c.Key);
             }
         }
         _log.Debug("releasing page count = " + free.Count + " out of " + _cache.Count);
         foreach (var i in free)
         {
             _cache.Remove(i);
         }
     }
     catch { }
 }
        private object processpayload(object data)
        {
            Packet       p   = (Packet)data;
            ReturnPacket ret = new ReturnPacket(true);

            if (Authenticate(p) == false)
            {
                return(new ReturnPacket(false, "Authentication failed"));
            }
            if (p.Command == "_close")
            {
                _connectedClients.Remove(p.ClientID);
                return(ret);
            }
            else
            {
                _connectedClients.Add(p.ClientID, true);
            }

            try
            {
                Handler d = null;
                if (_handlers.TryGetValue(p.Command, out d))
                {
                    d(p, ret);
                }
                else
                {
                    _log.Error("Command handler not found : " + p.Command);
                }
            }
            catch (Exception ex)
            {
                ret.OK = false;
                _log.Error(ex);
            }
            return(ret);
        }