Start downloading hostlists from hostlist servers as necessary.
1656{
1658 char *proxytype_str;
1660
1662 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
1663 {
1666 }
1669
1670
1674 "HOSTLIST",
1675 "PROXY",
1677 {
1679 "Found proxy host: `%s'\n",
1681
1684 "HOSTLIST",
1685 "PROXY_USERNAME",
1687 {
1689 "Found proxy username name: `%s'\n",
1691 }
1692
1693
1696 "HOSTLIST",
1697 "PROXY_PASSWORD",
1699 {
1701 "Found proxy password name: `%s'\n",
1703 }
1704
1705
1708 "HOSTLIST",
1709 "PROXY_TYPE",
1710 &proxytype_str))
1711 {
1712 char *pstr;
1713
1716 "Unable to convert `%s' to UTF-8 uppercase\n",
1717 proxytype_str);
1720 if (0 == strcmp (pstr, "HTTP"))
1722 else if (0 == strcmp (pstr, "HTTP_1_0"))
1724 else if (0 == strcmp (pstr, "SOCKS4"))
1726 else if (0 == strcmp (pstr, "SOCKS5"))
1728 else if (0 == strcmp (pstr, "SOCKS4A"))
1730 else if (0 == strcmp (pstr, "SOCKS5_HOSTNAME"))
1732 else
1733 {
1737 "Invalid proxy type: `%s', disabling proxy! Check configuration!\n")
1738 ,
1739 pstr);
1747
1749 }
1751 }
1752 }
1753
1762
1764 {
1767 _ (
"Learning is enabled on this peer\n"));
1770 "Hostlists will be saved to file again in %s\n",
1775 NULL);
1776 }
1777 else
1778 {
1780 _ (
"Learning is not enabled on this peer\n"));
1781 *msgh = NULL;
1783 "HOSTLIST",
1784 "HOSTLISTFILE",
1786 {
1788 {
1794 "Since learning is not enabled on this peer, hostlist file `%s' was removed\n"),
1796 else
1798 "remove",
1800 }
1801 }
1803 }
1805 "Loading stats value on hostlist download frequency\n");
1807 "hostlist",
1809 "# milliseconds between hostlist downloads"),
1812 NULL);
1814 {
1816 "Statistics request failed, scheduling hostlist download\n");
1818 }
1819 else
1820 {
1823 NULL);
1824 }
1826}
#define gettext_noop(String)
static struct GNUNET_CADET_Channel * ch
Channel handle.
static struct GNUNET_SCHEDULER_Task * st
The shutdown task.
#define SAVING_INTERVAL
Time interval hostlists are saved to disk.
static char * proxy
Proxy hostname or ip we are using (can be NULL).
static void handler_disconnect(void *cls, const struct GNUNET_PeerIdentity *peer, void *internal_cls)
Method called whenever a given peer disconnects.
static int process_stat(void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent)
We've received the previous delay value from statistics.
static void task_check(void *cls)
Task that checks if we should try to download a hostlist.
static void task_hostlist_saving(void *cls)
Task that writes hostlist entries to a file on a regular base.
static int stat_learning
Set if we are allowed to learn new hostlists and use them.
static struct Hostlist * linked_list_head
Head of the linked list used to store hostlists.
static void handler_advertisement(const char *uri)
Method called whenever an advertisement message arrives.
static unsigned int stat_use_bootstrap
Value saying if a preconfigured bootstrap server is used.
static struct GNUNET_STATISTICS_Handle * stats
Statistics handle.
static int stat_testing_allowed
Value controlling if a hostlist testing is allowed at the moment.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static struct GNUNET_PEERSTORE_Handle * peerstore
Handle to the PEERSTORE service.
static int stat_testing_hostlist
Value controlling if a hostlist is tested at the moment.
static char * proxy_password
Proxy password we are using (can be NULL).
static struct GNUNET_STATISTICS_GetHandle * sget
Handle for our statistics GET operation.
static void load_hostlist_file()
Method to load persistent hostlist file during hostlist client startup.
static void * handler_connect(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq, enum GNUNET_CORE_PeerClass class)
Method called whenever a given peer connects.
static struct Hostlist * linked_list_tail
Tail of the linked list used to store hostlists.
static struct GNUNET_SCHEDULER_Task * ti_check_download
ID of the task, checking if hostlist download should take plate.
static struct GNUNET_SCHEDULER_Task * ti_saving_task
ID of the task saving the hostlsit in a regular interval.
static char * proxy_username
Proxy username we are using (can be NULL).
static curl_proxytype proxy_type
Proxy type we are using (can be NULL).
static void primary_task(void *cls, int success)
Continuation called by the statistics code once we go the stat.
static int result
Global testing status.
static struct GNUNET_SCHEDULER_Task * stat_timeout_task
Task to timeout stat GET.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test(const char *fil)
Check that fil corresponds to a filename (of a file that exists and that is not a directory).
#define GNUNET_log(kind,...)
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_log_strerror_file(level, cmd, filename)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_PEERSTORE_Handle * GNUNET_PEERSTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the PEERSTORE service.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
struct GNUNET_STATISTICS_GetHandle * GNUNET_STATISTICS_get(struct GNUNET_STATISTICS_Handle *handle, const char *subsystem, const char *name, GNUNET_STATISTICS_Callback cont, GNUNET_STATISTICS_Iterator proc, void *cls)
Get statistic from the peer.
char * GNUNET_STRINGS_utf8_toupper(const char *input)
Convert the utf-8 input string to upper case.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
#define GNUNET_TIME_UNIT_MINUTES
One minute.