*/
static const struct GNUNET_CONFIGURATION_Handle *cfg;
-/**
- * Our scheduler.
- */
-static struct GNUNET_SCHEDULER_Handle *sched;
-
/**
* Statistics handle.
*/
1,
GNUNET_NO);
stat_hellos_obtained++;
- GNUNET_TRANSPORT_offer_hello (transport, msg);
+ GNUNET_TRANSPORT_offer_hello (transport, msg, NULL, NULL);
}
else
{
"Scheduling task for hostlist download using cURL\n");
#endif
ti_download
- = GNUNET_SCHEDULER_add_select (sched,
- GNUNET_SCHEDULER_PRIORITY_DEFAULT,
+ = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
GNUNET_SCHEDULER_NO_TASK,
rtime,
grs,
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Download in progess, have to wait...\n");
- ti_download_dispatcher_task = GNUNET_SCHEDULER_add_delayed (sched,
- WAITING_INTERVALL,
+ ti_download_dispatcher_task = GNUNET_SCHEDULER_add_delayed (WAITING_INTERVALL,
&task_download_dispatcher,
NULL);
}
if (stat_connection_count < MIN_CONNECTIONS)
{
- ti_download_dispatcher_task = GNUNET_SCHEDULER_add_now ( sched,
- &task_download_dispatcher,
+ ti_download_dispatcher_task = GNUNET_SCHEDULER_add_now (&task_download_dispatcher,
NULL);
}
stat_connection_count,
MIN_CONNECTIONS,
(unsigned long long) delay.rel_value);
- ti_check_download = GNUNET_SCHEDULER_add_delayed (sched,
- delay,
+ ti_check_download = GNUNET_SCHEDULER_add_delayed (delay,
&task_check,
NULL);
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Hostlists will be saved to file again in %llums\n"),
(unsigned long long) SAVING_INTERVALL.rel_value);
- ti_saving_task = GNUNET_SCHEDULER_add_delayed (sched,
- SAVING_INTERVALL,
+ ti_saving_task = GNUNET_SCHEDULER_add_delayed (SAVING_INTERVALL,
&task_hostlist_saving,
NULL);
}
*
* @param cls closure
* @param peer peer identity this notification is about
- * @param latency reported latency of the connection with 'other'
- * @param distance reported distance (DV) to 'other'
+ * @param atsi performance data
*/
static void
handler_connect (void *cls,
const struct
GNUNET_PeerIdentity * peer,
- struct GNUNET_TIME_Relative latency,
- uint32_t distance)
+ const struct GNUNET_TRANSPORT_ATS_Information *atsi)
{
- unsigned int max = 0 ;
- max --;
-
- if (stat_connection_count < max)
- {
+ GNUNET_assert (stat_connection_count < UINT_MAX);
stat_connection_count++;
GNUNET_STATISTICS_update (stats,
gettext_noop ("# active connections"),
1,
GNUNET_NO);
- }
}
GNUNET_assert (stat_connection_count > 0);
stat_connection_count--;
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# active connections"),
- -1,
- GNUNET_NO);
+ gettext_noop ("# active connections"),
+ -1,
+ GNUNET_NO);
}
/**
* @param cls closure (always NULL)
* @param peer the peer sending the message
* @param message the actual message
- * @param latency latency
- * @param distance distance
+ * @param atsi performance data
* @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,
- struct GNUNET_TIME_Relative latency,
- uint32_t distance)
+ const struct GNUNET_PeerIdentity * peer,
+ const struct GNUNET_MessageHeader * message,
+ const struct GNUNET_TRANSPORT_ATS_Information *atsi)
{
size_t size;
size_t uri_size;
stat_testing_hostlist = GNUNET_YES;
stat_testing_allowed = GNUNET_NO;
- ti_testing_intervall_task = GNUNET_SCHEDULER_add_delayed (sched,
- TESTING_INTERVAL,
+ ti_testing_intervall_task = GNUNET_SCHEDULER_add_delayed (TESTING_INTERVAL,
&task_testing_intervall_reset,
NULL);
"Testing new hostlist advertisements is locked for the next %u ms\n",
TESTING_INTERVAL.rel_value);
- ti_download_dispatcher_task = GNUNET_SCHEDULER_add_now (sched,
- &task_download_dispatcher,
+ ti_download_dispatcher_task = GNUNET_SCHEDULER_add_now (&task_download_dispatcher,
NULL);
return GNUNET_OK;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Statistics request done, scheduling hostlist download\n");
#endif
- ti_check_download = GNUNET_SCHEDULER_add_now (sched,
- &task_check,
+ ti_check_download = GNUNET_SCHEDULER_add_now (&task_check,
NULL);
}
"HOSTLISTFILE", "HOSTLIST");
return;
}
+ if (GNUNET_SYSERR == GNUNET_DISK_directory_create_for_file (filename))
+ return;
wh = GNUNET_BIO_write_open (filename);
if ( NULL == wh)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Writing %u hostlist URIs to `%s'\n" ),
linked_list_size, filename);
-
/* add code to write hostlists to file using bio */
ok = GNUNET_YES;
counter = 0;
*/
int
GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c,
- struct GNUNET_SCHEDULER_Handle *s,
struct GNUNET_STATISTICS_Handle *st,
GNUNET_CORE_ConnectEventHandler *ch,
GNUNET_CORE_DisconnectEventHandler *dh,
GNUNET_break (0);
return GNUNET_SYSERR;
}
- transport = GNUNET_TRANSPORT_connect (s, c, NULL, NULL, NULL, NULL, NULL);
+ transport = GNUNET_TRANSPORT_connect (c, NULL, NULL, NULL, NULL, NULL);
if (NULL == transport)
{
curl_global_cleanup ();
return GNUNET_SYSERR;
}
cfg = c;
- sched = s;
stats = st;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Hostlists will be saved to file again in %llums\n"),
(unsigned long long) SAVING_INTERVALL.rel_value);
- ti_saving_task = GNUNET_SCHEDULER_add_delayed (sched,
- SAVING_INTERVALL,
+ ti_saving_task = GNUNET_SCHEDULER_add_delayed (SAVING_INTERVALL,
&task_hostlist_saving,
NULL);
}
if (ti_saving_task != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_SCHEDULER_cancel (sched,
- ti_saving_task);
+ GNUNET_SCHEDULER_cancel (ti_saving_task);
}
if (ti_download_dispatcher_task != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_SCHEDULER_cancel (sched,
- ti_download_dispatcher_task);
+ GNUNET_SCHEDULER_cancel (ti_download_dispatcher_task);
}
if (ti_testing_intervall_task != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_SCHEDULER_cancel (sched,
- ti_testing_intervall_task);
+ GNUNET_SCHEDULER_cancel (ti_testing_intervall_task);
}
if (ti_download != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_SCHEDULER_cancel (sched,
- ti_download);
+ GNUNET_SCHEDULER_cancel (ti_download);
}
if (ti_check_download != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_SCHEDULER_cancel (sched,
- ti_check_download);
+ GNUNET_SCHEDULER_cancel (ti_check_download);
curl_global_cleanup ();
}
if (transport != NULL)
GNUNET_free_non_null (proxy);
proxy = NULL;
cfg = NULL;
- sched = NULL;
}
/* end of hostlist-client.c */