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  {
 1676    
 1678                                                            "HOSTLIST",
 1679                                                            "PROXY_USERNAME",
 1681    {
 1683                  "Found proxy username name: `%s'\n",
 1685    }
 1686 
 1687    
 1689                                                            "HOSTLIST",
 1690                                                            "PROXY_PASSWORD",
 1692    {
 1694                  "Found proxy password name: `%s'\n",
 1696    }
 1697 
 1698    
 1700                                                            "HOSTLIST",
 1701                                                            "PROXY_TYPE",
 1702                                                            &proxytype_str))
 1703    {
 1705                                                    proxytype_str))
 1707                    "Unable to convert `%s' to UTF-8 uppercase\n",
 1708                    proxytype_str);
 1710      if (0 == strcmp (proxytype_str, "HTTP"))
 1712      else if (0 == strcmp (proxytype_str, "HTTP_1_0"))
 1714      else if (0 == strcmp (proxytype_str, "SOCKS4"))
 1716      else if (0 == strcmp (proxytype_str, "SOCKS5"))
 1718      else if (0 == strcmp (proxytype_str, "SOCKS4A"))
 1720      else if (0 == strcmp (proxytype_str, "SOCKS5_HOSTNAME"))
 1722      else
 1723      {
 1727            "Invalid proxy type: `%s', disabling proxy! Check configuration!\n")
 1728          ,
 1729          proxytype_str);
 1737 
 1739      }
 1740    }
 1742  }
 1743 
 1752 
 1754  {
 1757                _ (
"Learning is enabled on this peer\n"));
 
 1760                "Hostlists will be saved to file again in %s\n",
 1765                                                   NULL);
 1766  }
 1767  else
 1768  {
 1770                _ (
"Learning is not enabled on this peer\n"));
 
 1771    *msgh = NULL;
 1773                                                              "HOSTLIST",
 1774                                                              "HOSTLISTFILE",
 1776    {
 1778      {
 1784              "Since learning is not enabled on this peer, hostlist file `%s' was removed\n"),
 1786        else
 1788                                    "remove",
 1790      }
 1791    }
 1793  }
 1795              "Loading stats value on hostlist download frequency\n");
 1797                                "hostlist",
 1799                                  "# milliseconds between hostlist downloads"),
 1802                                NULL);
 1804  {
 1806                "Statistics request failed, scheduling hostlist download\n");
 1808  }
 1809  else
 1810  {
 1813                                                      NULL);
 1814  }
 1816}
#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.
 
enum GNUNET_GenericReturnValue GNUNET_STRINGS_utf8_toupper(const char *input, char *output)
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.