clean_up ();
return;
}
- if (GNUNET_TIME_absolute_get_remaining (end_time).rel_value == 0)
+ if (0 == GNUNET_TIME_absolute_get_remaining (end_time).rel_value_us)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Timeout trying to download hostlist from `%s'\n"),
case CURLMSG_DONE:
if ((msg->data.result != CURLE_OK) &&
(msg->data.result != CURLE_GOT_NOTHING))
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Download of hostlist from `%s' failed: `%s'\n"),
current_url,
curl_easy_strerror (msg->data.result));
return;
}
CURL_EASY_SETOPT (curl, CURLOPT_FOLLOWLOCATION, 1);
+ CURL_EASY_SETOPT (curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
+ CURL_EASY_SETOPT (curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
CURL_EASY_SETOPT (curl, CURLOPT_MAXREDIRS, 4);
/* no need to abort if the above failed */
CURL_EASY_SETOPT (curl, CURLOPT_URL, current_url);
GNUNET_SCHEDULER_add_now (&task_download_dispatcher, NULL);
delay = hostlist_delay;
- if (hostlist_delay.rel_value == 0)
+ if (0 == hostlist_delay.rel_value_us)
hostlist_delay = GNUNET_TIME_UNIT_SECONDS;
else
hostlist_delay = GNUNET_TIME_relative_multiply (hostlist_delay, 2);
- if (hostlist_delay.rel_value >
- GNUNET_TIME_UNIT_HOURS.rel_value * (1 + stat_connection_count))
+ if (hostlist_delay.rel_value_us >
+ GNUNET_TIME_UNIT_HOURS.rel_value_us * (1 + stat_connection_count))
hostlist_delay =
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS,
(1 + stat_connection_count));
GNUNET_STATISTICS_set (stats,
gettext_noop
("# milliseconds between hostlist downloads"),
- hostlist_delay.rel_value, GNUNET_YES);
+ hostlist_delay.rel_value_us / 1000LL,
+ GNUNET_YES);
if (0 == once)
{
delay = GNUNET_TIME_UNIT_ZERO;
*
* @param cls closure
* @param peer peer identity this notification is about
- * @param atsi performance data
- * @param atsi_count number of records in 'atsi'
*/
static void
-handler_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi,
- unsigned int atsi_count)
+handler_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
{
GNUNET_assert (stat_connection_count < UINT_MAX);
stat_connection_count++;
* @param cls closure (always NULL)
* @param peer the peer sending the message
* @param message the actual message
- * @param atsi performance data
- * @param atsi_count number of records in 'atsi'
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
static int
handler_advertisement (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi,
- unsigned int atsi_count)
+ const struct GNUNET_MessageHeader *message)
{
size_t size;
size_t uri_size;
&task_testing_intervall_reset, NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Testing new hostlist advertisements is locked for the next %u ms\n",
- TESTING_INTERVAL.rel_value);
+ "Testing new hostlist advertisements is locked for the next %s\n",
+ GNUNET_STRINGS_relative_time_to_string (TESTING_INTERVAL,
+ GNUNET_YES));
ti_download_dispatcher_task =
GNUNET_SCHEDULER_add_now (&task_download_dispatcher, NULL);
}
+/**
+ * We've received the previous delay value from statistics. Remember it.
+ *
+ * @param cls NULL, unused
+ * @param subsystem should be "hostlist", unused
+ * @param name will be "milliseconds between hostlist downloads", unused
+ * @param value previous delay value, in milliseconds (!)
+ * @param is_persistent unused, will be GNUNET_YES
+ */
static int
process_stat (void *cls, const char *subsystem, const char *name,
uint64_t value, int is_persistent)
{
- hostlist_delay.rel_value = value;
+ hostlist_delay.rel_value_us = value * 1000LL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Initial time between hostlist downloads is %s\n",
GNUNET_STRINGS_relative_time_to_string (hostlist_delay, GNUNET_YES));
hostlist->hostlist_uri = (const char *) &hostlist[1];
memcpy (&hostlist[1], uri, strlen (uri) + 1);
hostlist->quality = quality;
- hostlist->time_creation.abs_value = created;
- hostlist->time_last_usage.abs_value = last_used;
+ hostlist->time_creation.abs_value_us = created;
+ hostlist->time_last_usage.abs_value_us = last_used;
GNUNET_CONTAINER_DLL_insert (linked_list_head, linked_list_tail, hostlist);
linked_list_size++;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
(GNUNET_OK != GNUNET_BIO_write_int32 (wh, pos->times_used)) ||
(GNUNET_OK != GNUNET_BIO_write_int64 (wh, pos->quality)) ||
(GNUNET_OK !=
- GNUNET_BIO_write_int64 (wh, pos->time_last_usage.abs_value)) ||
+ GNUNET_BIO_write_int64 (wh, pos->time_last_usage.abs_value_us)) ||
(GNUNET_OK !=
- GNUNET_BIO_write_int64 (wh, pos->time_creation.abs_value)) ||
+ GNUNET_BIO_write_int64 (wh, pos->time_creation.abs_value_us)) ||
(GNUNET_OK != GNUNET_BIO_write_int32 (wh, pos->hello_count)))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,