Dillo v3.1.1-98-g318d1f14
Loading...
Searching...
No Matches
cache.c File Reference
#include <sys/types.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include "msg.h"
#include "IO/Url.h"
#include "IO/IO.h"
#include "web.hh"
#include "dicache.h"
#include "nav.h"
#include "cookies.h"
#include "hsts.h"
#include "misc.h"
#include "capi.h"
#include "decode.h"
#include "auth.h"
#include "domain.h"
#include "timeout.hh"
#include "uicmd.hh"
Include dependency graph for cache.c:

Go to the source code of this file.

Macros

#define MAX_INIT_BUF   1024*1024
 Maximum initial size for the automatically-growing data buffer.
 
#define HUGE_FILESIZE   15*1024*1024
 Maximum filesize for a URL, before offering a download.
 

Functions

static CacheEntry_t * Cache_process_queue (CacheEntry_t *entry)
 Update cache clients for a single cache-entry Tasks:
 
static void Cache_delayed_process_queue (CacheEntry_t *entry)
 Set a call to Cache_process_queue from the main cycle.
 
static void Cache_auth_entry (CacheEntry_t *entry, BrowserWindow *bw)
 Set a timeout function to ask for user/password.
 
static void Cache_entry_inject (const DilloUrl *Url, Dstr *data_ds)
 Inject full page content directly into the cache.
 
static int Cache_entry_cmp (const void *v1, const void *v2)
 Determine if two cache entries are equal (used by CachedURLs)
 
static int Cache_entry_by_url_cmp (const void *v1, const void *v2)
 Determine if two cache entries are equal, using a URL as key.
 
void a_Cache_init (void)
 Initialize cache data.
 
static int Cache_client_enqueue (const DilloUrl *Url, DilloWeb *Web, CA_Callback_t Callback, void *CbData)
 Add a client to ClientQueue.
 
static int Cache_client_by_key_cmp (const void *client, const void *key)
 Compare function for searching a Client by its key.
 
static void Cache_client_dequeue (CacheClient_t *Client)
 Remove a client from the queue.
 
static void Cache_entry_init (CacheEntry_t *NewEntry, const DilloUrl *Url)
 Set safe values for a new cache entry.
 
static CacheEntry_t * Cache_entry_search (const DilloUrl *Url)
 Get the data structure for a cached URL (using 'Url' as the search key) If 'Url' isn't cached, return NULL.
 
static CacheEntry_t * Cache_entry_search_with_redirect (const DilloUrl *Url)
 Given a URL, find its cache entry, following redirections.
 
static CacheEntry_t * Cache_entry_add (const DilloUrl *Url)
 Allocate and set a new entry in the cache list.
 
static void Cache_auth_free (Dlist *auth)
 Free Authentication fields.
 
static void Cache_entry_free (CacheEntry_t *entry)
 Free the components of a CacheEntry_t struct.
 
static void Cache_entry_remove (CacheEntry_t *entry, DilloUrl *url)
 Remove an entry, from the cache.
 
void a_Cache_entry_remove_by_url (DilloUrl *url)
 Wrapper for capi.
 
int a_Cache_open_url (void *web, CA_Callback_t Call, void *CbData)
 Try finding the url in the cache.
 
uint_t a_Cache_get_flags (const DilloUrl *url)
 Get cache entry status.
 
uint_t a_Cache_get_flags_with_redirection (const DilloUrl *url)
 Get cache entry status (following redirections).
 
static void Cache_ref_data (CacheEntry_t *entry)
 Reference the cache data.
 
static void Cache_unref_data (CacheEntry_t *entry)
 Unreference the cache data.
 
static const char * Cache_current_content_type (CacheEntry_t *entry)
 Get current content type.
 
const char * a_Cache_get_content_type (const DilloUrl *url)
 Get current Content-Type for cache entry found by URL.
 
static DstrCache_data (CacheEntry_t *entry)
 Get pointer to entry's data.
 
const char * a_Cache_set_content_type (const DilloUrl *url, const char *ctype, const char *from)
 Change Content-Type for cache entry found by url.
 
int a_Cache_get_buf (const DilloUrl *Url, char **PBuf, int *BufSize)
 Get the pointer to the URL document, and its size, from the cache entry.
 
void a_Cache_unref_buf (const DilloUrl *Url)
 Unreference the data buffer when no longer using it.
 
static char * Cache_parse_field (const char *header, const char *fieldname)
 Extract a single field from the header, allocating and storing the value in 'field'.
 
static DlistCache_parse_multiple_fields (const char *header, const char *fieldname)
 Extract multiple fields from the header.
 
static void Cache_parse_header (CacheEntry_t *entry)
 Scan, allocate, and set things according to header info.
 
static int Cache_get_header (CacheEntry_t *entry, const char *buf, size_t buf_size)
 Consume bytes until the whole header is got (up to a "\r\n\r\n" sequence) (Also unfold multi-line fields and strip '\r' chars from header)
 
static void Cache_finish_msg (CacheEntry_t *entry)
 
bool_t a_Cache_process_dbuf (int Op, const char *buf, size_t buf_size, const DilloUrl *Url)
 Receive new data, update the reception buffer (for next read), update the cache, and service the client queue.
 
static int Cache_redirect (CacheEntry_t *entry, int Flags, BrowserWindow *bw)
 Process redirections (HTTP 30x answers) (This is a work in progress –not finished yet)
 
static void Cache_auth_callback (void *vdata)
 Ask for user/password and reload the page.
 
int a_Cache_download_enabled (const DilloUrl *url)
 Check whether a URL scheme is downloadable.
 
static void Cache_null_client (int Op, CacheClient_t *Client)
 Don't process data any further, but let the cache fill the entry.
 
static void Cache_savelink_cb (void *vdata)
 Save link from behind a timeout so that Cache_process_queue() can get on with its work.
 
static void Cache_provide_redirection_blocked_page (CacheEntry_t *entry, CacheClient_t *client)
 Let the client know that we're not following a redirection.
 
static void Cache_delayed_process_queue_callback (void *ptr)
 Callback function for Cache_delayed_process_queue.
 
CacheClient_ta_Cache_client_get_if_unique (int Key)
 Last Client for this entry?
 
void a_Cache_stop_client (int Key)
 Remove a client from the client queue TODO: notify the dicache and upper layers.
 
void a_Cache_freeall (void)
 Memory deallocator (only called at exit time)
 

Variables

static DlistCachedURLs
 A sorted list for cached data.
 
static DlistClientQueue
 A list for cache clients.
 
static DlistDelayedQueue
 A list for delayed clients (it holds weak pointers to cache entries, which are used to make deferred calls to Cache_process_queue)
 
static uint_t DelayedQueueIdleId = 0
 

Macro Definition Documentation

◆ HUGE_FILESIZE

#define HUGE_FILESIZE   15*1024*1024

Maximum filesize for a URL, before offering a download.

Definition at line 43 of file cache.c.

◆ MAX_INIT_BUF

#define MAX_INIT_BUF   1024*1024

Maximum initial size for the automatically-growing data buffer.

Definition at line 41 of file cache.c.

Function Documentation

◆ a_Cache_client_get_if_unique()

CacheClient_t * a_Cache_client_get_if_unique ( int  Key)

Last Client for this entry?

Returns
Client if true, NULL otherwise (cache.c has only one call to a capi function. This avoids a second one)

Definition at line 1399 of file cache.c.

References Cache_client_by_key_cmp(), ClientQueue, dList_find_custom(), dList_nth_data(), INT2VOIDP, and CacheClient::Url.

Referenced by a_Capi_stop_client().

◆ a_Cache_download_enabled()

int a_Cache_download_enabled ( const DilloUrl url)

Check whether a URL scheme is downloadable.

Returns
1 enabled, 0 disabled.

Definition at line 1093 of file cache.c.

References dStrAsciiCasecmp(), and URL_SCHEME.

Referenced by a_Capi_open_url(), and Cache_process_queue().

◆ a_Cache_entry_remove_by_url()

void a_Cache_entry_remove_by_url ( DilloUrl url)

Wrapper for capi.

Definition at line 357 of file cache.c.

References Cache_entry_remove().

Referenced by a_Capi_ccc().

◆ a_Cache_freeall()

void a_Cache_freeall ( void  )

Memory deallocator (only called at exit time)

Definition at line 1448 of file cache.c.

References Cache_client_dequeue(), Cache_entry_free(), CachedURLs, ClientQueue, dList_free(), dList_nth_data(), and dList_remove_fast().

Referenced by main().

◆ a_Cache_get_buf()

int a_Cache_get_buf ( const DilloUrl Url,
char **  PBuf,
int *  BufSize 
)

Get the pointer to the URL document, and its size, from the cache entry.

Returns
1 cached, 0 not cached.

Definition at line 552 of file cache.c.

References Cache_data(), Cache_entry_search_with_redirect(), Cache_ref_data(), Dstr::len, and Dstr::str.

Referenced by a_Capi_get_buf().

◆ a_Cache_get_content_type()

const char * a_Cache_get_content_type ( const DilloUrl url)

Get current Content-Type for cache entry found by URL.

Definition at line 472 of file cache.c.

References Cache_current_content_type(), and Cache_entry_search_with_redirect().

Referenced by a_Capi_get_content_type().

◆ a_Cache_get_flags()

uint_t a_Cache_get_flags ( const DilloUrl url)

Get cache entry status.

Definition at line 406 of file cache.c.

References Cache_entry_search().

Referenced by a_Capi_get_flags().

◆ a_Cache_get_flags_with_redirection()

uint_t a_Cache_get_flags_with_redirection ( const DilloUrl url)

Get cache entry status (following redirections).

Definition at line 415 of file cache.c.

References Cache_entry_search_with_redirect().

Referenced by a_Capi_get_flags_with_redirection().

◆ a_Cache_init()

void a_Cache_init ( void  )

Initialize cache data.

Definition at line 118 of file cache.c.

References a_Url_free(), a_Url_new(), AboutSplash, Cache_entry_inject(), CachedURLs, ClientQueue, DelayedQueue, dList_new(), dStr_free(), and dStr_new().

Referenced by a_Capi_init().

◆ a_Cache_open_url()

int a_Cache_open_url ( void *  web,
CA_Callback_t  Call,
void *  CbData 
)

Try finding the url in the cache.

If it hits, send the cache contents from there. If it misses, set up a new connection.

  • 'Web' is an auxiliary data structure with misc. parameters.
  • 'Call' is the callback that receives the data
  • 'CbData' is custom data passed to 'Call' Note: 'Call' and/or 'CbData' can be NULL, in that case they get set later by a_Web_dispatch_by_type, based on content/type and 'Web' data.
Returns
A primary key for identifying the client,

Definition at line 376 of file cache.c.

References Cache_client_enqueue(), Cache_delayed_process_queue(), Cache_entry_add(), Cache_entry_remove(), Cache_entry_search(), _DilloWeb::url, URL_E2EQuery, and URL_FLAGS.

Referenced by a_Capi_open_url().

◆ a_Cache_process_dbuf()

bool_t a_Cache_process_dbuf ( int  Op,
const char *  buf,
size_t  buf_size,
const DilloUrl Url 
)

Receive new data, update the reception buffer (for next read), update the cache, and service the client queue.

This function gets called whenever the IO has new data. 'Op' is the operation to perform 'VPtr' is a (void) pointer to the IO control structure

Definition at line 897 of file cache.c.

References _MSG, a_Bw_remove_client(), a_Decode_process(), a_Decode_transfer_finished(), a_Decode_transfer_process(), _DilloWeb::bw, CA_Aborted, CA_GotHeader, CA_GotLength, CA_KeepAlive, Cache_client_dequeue(), Cache_entry_search(), Cache_finish_msg(), Cache_get_header(), Cache_parse_header(), Cache_process_queue(), ClientQueue, dList_nth_data(), dReturn_val_if_fail, dStr_append_l(), dStr_free(), FALSE, IOAbort, IOClose, IORead, CacheClient::Key, Dstr::len, MSG, Dstr::str, TRUE, CacheClient::Url, URL_STR, and CacheClient::Web.

Referenced by a_Capi_ccc().

◆ a_Cache_set_content_type()

const char * a_Cache_set_content_type ( const DilloUrl url,
const char *  ctype,
const char *  from 
)

Change Content-Type for cache entry found by url.

from = { "http" | "meta" }

Returns
new content type.

Definition at line 492 of file cache.c.

References _MSG, a_Decode_charset_init(), a_Decode_free(), a_Misc_content_type_cmp(), a_Misc_parse_content_type(), Cache_current_content_type(), Cache_entry_search(), dFree(), dReturn_val_if_fail, dStr_free(), dStrconcat(), dStrdup(), dStrnAsciiCasecmp(), and URL_STR.

Referenced by a_Capi_set_content_type(), and Cache_parse_header().

◆ a_Cache_stop_client()

void a_Cache_stop_client ( int  Key)

Remove a client from the client queue TODO: notify the dicache and upper layers.

Definition at line 1419 of file cache.c.

References _MSG, a_Dicache_get_entry(), a_Dicache_unref(), Cache_client_by_key_cmp(), Cache_client_dequeue(), Cache_entry_search(), ClientQueue, DelayedQueue, dList_find_custom(), dList_remove(), INT2VOIDP, CacheClient::Url, and CacheClient::Version.

Referenced by a_Capi_stop_client(), and Cache_entry_remove().

◆ a_Cache_unref_buf()

void a_Cache_unref_buf ( const DilloUrl Url)

Unreference the data buffer when no longer using it.

Definition at line 571 of file cache.c.

References Cache_entry_search_with_redirect(), and Cache_unref_data().

Referenced by a_Capi_unref_buf().

◆ Cache_auth_callback()

static void Cache_auth_callback ( void *  vdata)
static

Ask for user/password and reload the page.

Definition at line 1054 of file cache.c.

References a_Auth_do_auth(), a_Nav_reload(), a_Timeout_remove(), a_Url_free(), Cache_auth_entry(), Cache_auth_free(), and dFree().

Referenced by Cache_auth_entry().

◆ Cache_auth_entry()

static void Cache_auth_entry ( CacheEntry_t *  entry,
BrowserWindow bw 
)
static

Set a timeout function to ask for user/password.

Definition at line 1069 of file cache.c.

References a_Timeout_add(), a_Url_dup(), Cache_auth_callback(), dNew, and MSG_WARN.

Referenced by Cache_auth_callback(), and Cache_process_queue().

◆ Cache_auth_free()

static void Cache_auth_free ( Dlist auth)
static

Free Authentication fields.

Definition at line 287 of file cache.c.

References dFree(), dList_free(), and dList_nth_data().

Referenced by Cache_auth_callback(), and Cache_entry_free().

◆ Cache_client_by_key_cmp()

static int Cache_client_by_key_cmp ( const void *  client,
const void *  key 
)
static

Compare function for searching a Client by its key.

Definition at line 170 of file cache.c.

References VOIDP2INT.

Referenced by a_Cache_client_get_if_unique(), and a_Cache_stop_client().

◆ Cache_client_dequeue()

static void Cache_client_dequeue ( CacheClient_t Client)
static

Remove a client from the queue.

Definition at line 178 of file cache.c.

References a_Web_free(), ClientQueue, dFree(), dList_remove(), and CacheClient::Web.

Referenced by a_Cache_freeall(), a_Cache_process_dbuf(), a_Cache_stop_client(), and Cache_process_queue().

◆ Cache_client_enqueue()

static int Cache_client_enqueue ( const DilloUrl Url,
DilloWeb Web,
CA_Callback_t  Callback,
void *  CbData 
)
static

Add a client to ClientQueue.

  • Every client-field is just a reference (except 'Web').
  • Return a unique number for identifying the client.

Definition at line 141 of file cache.c.

References CacheClient::Buf, CacheClient::BufSize, CacheClient::Callback, CacheClient::CbData, ClientQueue, dList_append(), dNew, CacheClient::Key, CacheClient::Url, CacheClient::Version, and CacheClient::Web.

Referenced by a_Cache_open_url().

◆ Cache_current_content_type()

static const char * Cache_current_content_type ( CacheEntry_t *  entry)
static

Get current content type.

Definition at line 463 of file cache.c.

Referenced by a_Cache_get_content_type(), a_Cache_set_content_type(), and Cache_process_queue().

◆ Cache_data()

static Dstr * Cache_data ( CacheEntry_t *  entry)
static

Get pointer to entry's data.

Definition at line 482 of file cache.c.

Referenced by a_Cache_get_buf(), and Cache_process_queue().

◆ Cache_delayed_process_queue()

static void Cache_delayed_process_queue ( CacheEntry_t *  entry)
static

Set a call to Cache_process_queue from the main cycle.

Definition at line 1381 of file cache.c.

References _MSG, a_Timeout_add(), Cache_delayed_process_queue_callback(), DelayedQueue, DelayedQueueIdleId, dList_append(), and dList_find().

Referenced by a_Cache_open_url().

◆ Cache_delayed_process_queue_callback()

static void Cache_delayed_process_queue_callback ( void *  ptr)
static

Callback function for Cache_delayed_process_queue.

Definition at line 1362 of file cache.c.

References a_Timeout_remove(), Cache_process_queue(), Cache_ref_data(), Cache_unref_data(), DelayedQueue, DelayedQueueIdleId, dList_nth_data(), and dList_remove().

Referenced by Cache_delayed_process_queue().

◆ Cache_entry_add()

static CacheEntry_t * Cache_entry_add ( const DilloUrl Url)
static

Allocate and set a new entry in the cache list.

Definition at line 250 of file cache.c.

References Cache_entry_cmp(), Cache_entry_init(), Cache_entry_search(), CachedURLs, dList_insert_sorted(), dList_remove(), dNew, and MSG_WARN.

Referenced by a_Cache_open_url(), and Cache_entry_inject().

◆ Cache_entry_by_url_cmp()

static int Cache_entry_by_url_cmp ( const void *  v1,
const void *  v2 
)
static

Determine if two cache entries are equal, using a URL as key.

Definition at line 107 of file cache.c.

References a_Url_cmp().

Referenced by Cache_entry_search().

◆ Cache_entry_cmp()

static int Cache_entry_cmp ( const void *  v1,
const void *  v2 
)
static

Determine if two cache entries are equal (used by CachedURLs)

Definition at line 97 of file cache.c.

References a_Url_cmp().

Referenced by Cache_entry_add().

◆ Cache_entry_free()

static void Cache_entry_free ( CacheEntry_t *  entry)
static

Free the components of a CacheEntry_t struct.

Definition at line 299 of file cache.c.

References a_Decode_free(), a_Decode_transfer_free(), a_Url_free(), Cache_auth_free(), dFree(), dStr_free(), and TRUE.

Referenced by a_Cache_freeall(), and Cache_entry_remove().

◆ Cache_entry_init()

static void Cache_entry_init ( CacheEntry_t *  NewEntry,
const DilloUrl Url 
)
static

Set safe values for a new cache entry.

Definition at line 193 of file cache.c.

References a_Url_dup(), CA_InProgress, CA_IsEmpty, CA_KeepAlive, dStr_new(), and dStr_sized_new().

Referenced by Cache_entry_add().

◆ Cache_entry_inject()

static void Cache_entry_inject ( const DilloUrl Url,
Dstr data_ds 
)
static

Inject full page content directly into the cache.

Used for "about:splash". May be used for "about:cache" too.

Definition at line 269 of file cache.c.

References CA_GotHeader, CA_GotLength, CA_InternalUrl, Cache_entry_add(), Cache_entry_search(), dStr_append_l(), dStr_fit(), dStr_truncate(), Dstr::len, and Dstr::str.

Referenced by a_Cache_init().

◆ Cache_entry_remove()

static void Cache_entry_remove ( CacheEntry_t *  entry,
DilloUrl url 
)
static

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).

Definition at line 325 of file cache.c.

References a_Cache_stop_client(), a_Dicache_invalidate_entry(), CA_InternalUrl, Cache_entry_free(), Cache_entry_search(), CachedURLs, ClientQueue, DelayedQueue, dList_nth_data(), dList_remove(), CacheClient::Key, and CacheClient::Url.

Referenced by a_Cache_entry_remove_by_url(), a_Cache_open_url(), and Cache_process_queue().

◆ Cache_entry_search()

static CacheEntry_t * Cache_entry_search ( const DilloUrl Url)
static

Get the data structure for a cached URL (using 'Url' as the search key) If 'Url' isn't cached, return NULL.

Definition at line 218 of file cache.c.

References Cache_entry_by_url_cmp(), CachedURLs, and dList_find_sorted().

Referenced by a_Cache_get_flags(), a_Cache_open_url(), a_Cache_process_dbuf(), a_Cache_set_content_type(), a_Cache_stop_client(), Cache_entry_add(), Cache_entry_inject(), Cache_entry_remove(), and Cache_entry_search_with_redirect().

◆ Cache_entry_search_with_redirect()

static CacheEntry_t * Cache_entry_search_with_redirect ( const DilloUrl Url)
static

Given a URL, find its cache entry, following redirections.

Definition at line 226 of file cache.c.

References _MSG_WARN, CA_Redirect, CA_RedirectLoop, Cache_entry_search(), and URL_STR_.

Referenced by a_Cache_get_buf(), a_Cache_get_content_type(), a_Cache_get_flags_with_redirection(), and a_Cache_unref_buf().

◆ Cache_finish_msg()

static void Cache_finish_msg ( CacheEntry_t *  entry)
static

◆ Cache_get_header()

static int Cache_get_header ( CacheEntry_t *  entry,
const char *  buf,
size_t  buf_size 
)
static

Consume bytes until the whole header is got (up to a "\r\n\r\n" sequence) (Also unfold multi-line fields and strip '\r' chars from header)

Definition at line 824 of file cache.c.

References _MSG, CA_GotHeader, dStr_append_c(), dStr_erase(), dStr_fit(), Dstr::len, and Dstr::str.

Referenced by a_Cache_process_dbuf().

◆ Cache_null_client()

static void Cache_null_client ( int  Op,
CacheClient_t Client 
)
static

Don't process data any further, but let the cache fill the entry.

(Currently used to handle WEB_RootUrl redirects, and to ignore image redirects –Jcid)

Definition at line 1107 of file cache.c.

References a_Bw_close_client(), _DilloWeb::bw, CA_Close, _DilloWeb::flags, CacheClient::Key, CacheClient::Web, and WEB_RootUrl.

Referenced by Cache_process_queue().

◆ Cache_parse_field()

static char * Cache_parse_field ( const char *  header,
const char *  fieldname 
)
static

Extract a single field from the header, allocating and storing the value in 'field'.

('fieldname' must not include the trailing ':')

Returns
a new string with the field-content if found (NULL on error) (This function expects a '\r'-stripped header, with one-line header fields)

Definition at line 583 of file cache.c.

References D_ASCII_TOLOWER, and dStrndup().

Referenced by Cache_parse_header().

◆ Cache_parse_header()

◆ Cache_parse_multiple_fields()

static Dlist * Cache_parse_multiple_fields ( const char *  header,
const char *  fieldname 
)
static

Extract multiple fields from the header.

Definition at line 617 of file cache.c.

References D_ASCII_TOLOWER, dList_append(), dList_free(), dList_length(), dList_new(), and dStrndup().

Referenced by Cache_parse_header().

◆ Cache_process_queue()

static CacheEntry_t * Cache_process_queue ( CacheEntry_t *  entry)
static

◆ Cache_provide_redirection_blocked_page()

static void Cache_provide_redirection_blocked_page ( CacheEntry_t *  entry,
CacheClient_t client 
)
static

Let the client know that we're not following a redirection.

Definition at line 1145 of file cache.c.

References a_Web_dispatch_by_type(), CacheClient::Buf, CacheClient::BufSize, CA_Send, CacheClient::Callback, CacheClient::CbData, dFree(), dStrconcat(), URL_STR, and CacheClient::Web.

Referenced by Cache_process_queue().

◆ Cache_redirect()

static int Cache_redirect ( CacheEntry_t *  entry,
int  Flags,
BrowserWindow bw 
)
static

Process redirections (HTTP 30x answers) (This is a work in progress –not finished yet)

Definition at line 996 of file cache.c.

References _MSG, a_Nav_push(), a_UIcmd_set_msg(), a_Url_free(), a_Url_new(), a_Url_set_flags(), CA_ForceRedirect, CA_Redirect, CA_RedirectLoop, CA_TempRedirect, BrowserWindow::redirect_level, URL_E2EQuery, URL_FLAGS, URL_SpamSafe, URL_STR_, and WEB_RootUrl.

Referenced by Cache_process_queue().

◆ Cache_ref_data()

static void Cache_ref_data ( CacheEntry_t *  entry)
static

Reference the cache data.

Definition at line 424 of file cache.c.

References _MSG, a_Decode_process(), and dStr_free().

Referenced by a_Cache_get_buf(), Cache_delayed_process_queue_callback(), and Cache_parse_header().

◆ Cache_savelink_cb()

static void Cache_savelink_cb ( void *  vdata)
static

Save link from behind a timeout so that Cache_process_queue() can get on with its work.

Definition at line 1133 of file cache.c.

References a_UIcmd_save_link(), a_Url_free(), and dFree().

Referenced by Cache_process_queue().

◆ Cache_unref_data()

static void Cache_unref_data ( CacheEntry_t *  entry)
static

Unreference the cache data.

Definition at line 442 of file cache.c.

References _MSG, dStr_free(), and MSG_ERR.

Referenced by a_Cache_unref_buf(), Cache_delayed_process_queue_callback(), and Cache_finish_msg().

Variable Documentation

◆ CachedURLs

Dlist* CachedURLs
static

A sorted list for cached data.

Holds pointers to CacheEntry_t structs

Definition at line 74 of file cache.c.

Referenced by a_Cache_freeall(), a_Cache_init(), Cache_entry_add(), Cache_entry_remove(), and Cache_entry_search().

◆ ClientQueue

Dlist* ClientQueue
static

A list for cache clients.

Although implemented as a list, we'll call it ClientQueue –Jcid

Definition at line 78 of file cache.c.

Referenced by a_Cache_client_get_if_unique(), a_Cache_freeall(), a_Cache_init(), a_Cache_process_dbuf(), a_Cache_stop_client(), Cache_client_dequeue(), Cache_client_enqueue(), Cache_entry_remove(), Cache_parse_header(), and Cache_process_queue().

◆ DelayedQueue

Dlist* DelayedQueue
static

A list for delayed clients (it holds weak pointers to cache entries, which are used to make deferred calls to Cache_process_queue)

Definition at line 82 of file cache.c.

Referenced by a_Cache_init(), a_Cache_stop_client(), Cache_delayed_process_queue(), Cache_delayed_process_queue_callback(), and Cache_entry_remove().

◆ DelayedQueueIdleId

uint_t DelayedQueueIdleId = 0
static

Definition at line 83 of file cache.c.

Referenced by Cache_delayed_process_queue(), and Cache_delayed_process_queue_callback().