Ejemplo n.º 1
0
/*
 * Remove an entry, from the cache.
 * All the entry clients are removed too! (it may stop rendering of this
 * same resource on other windows, but nothing more).
 */
static void Cache_entry_remove(CacheEntry_t *entry, DilloUrl *url)
{
   int i;
   CacheClient_t *Client;

   if (!entry && !(entry = Cache_entry_search(url)))
      return;
   if (entry->Flags & CA_InternalUrl)
      return;

   /* remove all clients for this entry */
   for (i = 0; (Client = dList_nth_data(ClientQueue, i)); ++i) {
      if (Client->Url == entry->Url) {
         a_Cache_stop_client(Client->Key);
         --i;
      }
   }

   /* remove from DelayedQueue */
   dList_remove(DelayedQueue, entry);

   /* remove from dicache */
   a_Dicache_invalidate_entry(entry->Url);

   /* remove from cache */
   dList_remove(CachedURLs, entry);
   Cache_entry_free(entry);
}
Ejemplo n.º 2
0
/*
 * Delete node. This will not free any cookies that might be in node->cookies.
 */
static void Cookies_delete_node(DomainNode *node)
{
   dList_remove(domains, node);
   dFree(node->domain);
   dList_free(node->cookies);
   dFree(node);
}
Ejemplo n.º 3
0
/*
 * Remove a client from the queue
 */
static void Cache_client_dequeue(CacheClient_t *Client)
{
   if (Client) {
      dList_remove(ClientQueue, Client);
      a_Web_free(Client->Web);
      dFree(Client);
   }
}
Ejemplo n.º 4
0
/*
 * Remove a client from the queue
 */
static void Cache_client_dequeue(CacheClient_t *Client, int Key)
{
   if (!Client) {
      Client = dList_find_custom(ClientQueue, INT2VOIDP(Key),
                                 Cache_client_by_key_cmp);
   }
   if (Client) {
      dList_remove(ClientQueue, Client);
      a_Web_free(Client->Web);
      dFree(Client);
   }
}
Ejemplo n.º 5
0
/*
 * Allocate and set a new entry in the cache list
 */
static CacheEntry_t *Cache_entry_add(const DilloUrl *Url)
{
   CacheEntry_t *old_entry, *new_entry;

   if ((old_entry = Cache_entry_search(Url))) {
      MSG_WARN("Cache_entry_add, leaking an entry.\n");
      dList_remove(CachedURLs, old_entry);
   }

   new_entry = dNew(CacheEntry_t, 1);
   Cache_entry_init(new_entry, Url);  /* Set safe values */
   dList_insert_sorted(CachedURLs, new_entry, Cache_entry_cmp);
   return new_entry;
}
Ejemplo n.º 6
0
/*
 * Callback function for Cache_delayed_process_queue.
 */
static void Cache_delayed_process_queue_callback()
{
   CacheEntry_t *entry;

   while ((entry = (CacheEntry_t *)dList_nth_data(DelayedQueue, 0))) {
      Cache_ref_data(entry);
      if ((entry = Cache_process_queue(entry))) {
         Cache_unref_data(entry);
         dList_remove(DelayedQueue, entry);
      }
   }
   DelayedQueueIdleId = 0;
   a_Timeout_remove();
}
Ejemplo n.º 7
0
/*
 * Decrement the reference count (and remove from list when zero)
 */
static void Capi_conn_unref(capi_conn_t *conn)
{
   _MSG(" Capi_conn_unref #%d %p\n", conn->Ref - 1, conn);

   /* We may validate conn here, but it doesn't *seem* necessary */
   if (--conn->Ref == 0) {
      /* remove conn preserving the list order */
      dList_remove(CapiConns, (void *)conn);
      /* free dynamic memory */
      a_Url_free(conn->url);
      dFree(conn->server);
      dFree(conn->datastr);
      dFree(conn);
   }
   _MSG(" Capi_conn_unref CapiConns=%d\n", dList_length(CapiConns));
}
Ejemplo n.º 8
0
/*
 * Remove a client from the client queue
 * TODO: notify the dicache and upper layers
 */
void a_Cache_stop_client(int Key)
{
   CacheClient_t *Client;
   CacheEntry_t *entry;
   DICacheEntry *DicEntry;

   /* The client can be in both queues at the same time */
   if ((Client = dList_find_custom(ClientQueue, INT2VOIDP(Key),
                                   Cache_client_by_key_cmp))) {
      /* Dicache */
      if ((DicEntry = a_Dicache_get_entry(Client->Url, Client->Version)))
         a_Dicache_unref(Client->Url, Client->Version);

      /* DelayedQueue */
      if ((entry = Cache_entry_search(Client->Url)))
         dList_remove(DelayedQueue, entry);

      /* Main queue */
      Cache_client_dequeue(Client, NULLKey);

   } else {
      _MSG("WARNING: Cache_stop_client, nonexistent client\n");
   }
}