Richard Eckart
#include "common.h"
#include "if/core/hcache.h"
#include "if/core/hosts.h"
Go to the source code of this file.
Functions | |
void | hcache_init (void) |
Initialize host caches. | |
void | hcache_shutdown (void) |
Shutdown host caches. | |
void | hcache_close (void) |
Destroy all host caches. | |
void | hcache_retrieve_all (void) |
Load hostcache data from disk. | |
void | hcache_timer (time_t now) |
Host cache timer. | |
const gchar * | host_type_to_string (host_type_t type) |
Convert host type to string. | |
const gchar * | hcache_type_to_string (hcache_type_t type) |
Convert host cache type to string. | |
gboolean | hcache_add (hcache_type_t type, const host_addr_t addr, guint16 port, const gchar *what) |
Register a host. | |
gboolean | hcache_add_caught (host_type_t type, const host_addr_t addr, guint16 port, const gchar *what) |
Add a caught (fresh) host to the right list depending on the host type. | |
gboolean | hcache_add_valid (host_type_t type, const host_addr_t addr, guint16 port, const gchar *what) |
Add a valid host to the right list depending on the host type. | |
gboolean | hcache_node_is_bad (const host_addr_t addr) |
void | hcache_prune (hcache_type_t type) |
Remove hosts that exceed our maximum. | |
gboolean | hcache_read_finished (void) |
Check whether the host caches are completely read. | |
gint | hcache_size (host_type_t type) |
gboolean | hcache_is_low (host_type_t type) |
Do we have less that our mimumum amount of hosts in the cache? | |
gint | hcache_fill_caught_array (host_type_t type, gnet_host_t *hosts, gint hcount) |
Fill `hosts', an array of `hcount' hosts already allocated with at most `hcount' hosts from out caught list, without removing those hosts from the list. | |
void | hcache_get_caught (host_type_t type, host_addr_t *addr, guint16 *port) |
Get host IP/port information from our caught host list, or from the recent pong cache, in alternance. | |
gboolean | hcache_find_nearby (host_type_t type, host_addr_t *addr, guint16 *port) |
Finds a host in either the pong_cache or the host_cache that is in one of the local networks. | |
void | hcache_store_if_dirty (host_type_t type) |
Save hostcache data to disk, for the relevant host type. |
|
Register a host. If a host is already on the known hosts hashtable, it will not be registered. Otherwise it will be added to the hashtable of known hosts and added to one of the host lists as indicated by the "list" parameter. Sanity checks are only applied when the host is added to HL_CAUGHT, since when a host is added to any of the other lists it must have been in HL_CAUGHT or in the pong-cache before.
|
|
Add a caught (fresh) host to the right list depending on the host type.
|
|
Add a valid host to the right list depending on the host type.
|
|
Destroy all host caches.
|
|
Fill `hosts', an array of `hcount' hosts already allocated with at most `hcount' hosts from out caught list, without removing those hosts from the list.
|
|
Finds a host in either the pong_cache or the host_cache that is in one of the local networks.
|
|
Get host IP/port information from our caught host list, or from the recent pong cache, in alternance.
|
|
Initialize host caches.
|
|
Do we have less that our mimumum amount of hosts in the cache?
|
|
|
|
Remove hosts that exceed our maximum. This can be called on HCACHE_FRESH_ANY and on HCACHE_FRESH_ULTRA. If too many hosts are in the cache, then it will prune the HCACHE_FRESH_XXX list. Only after HCACHE_FRESH_XXX is empty HCACHE_VALID_XXX will be moved to HCACHE_FRESH_XXX and then it is purged. |
|
Check whether the host caches are completely read. This should be used before contacting a GWebCache at start-up time.
|
|
Load hostcache data from disk.
|
|
Shutdown host caches.
|
|
|
|
Save hostcache data to disk, for the relevant host type.
|
|
Host cache timer.
|
|
Convert host cache type to string.
|
|
Convert host type to string.
|