static struct GNUNET_SCHEDULER_Task *err_task;
-static struct GNUNET_SCHEDULER_Task *con_task;
-
static int ok;
#define OKPP do { ok++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
GNUNET_assert (ok == 6);
terminate_peer (&p1);
terminate_peer (&p2);
- if (NULL != con_task)
- {
- GNUNET_SCHEDULER_cancel (con_task);
- con_task = NULL;
- }
ok = 0;
}
GNUNET_break (0);
terminate_peer (&p1);
terminate_peer (&p2);
- if (NULL != con_task)
- {
- GNUNET_SCHEDULER_cancel (con_task);
- con_task = NULL;
- }
ok = 42;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Encrypted connection established to peer `%4s'\n",
GNUNET_i2s (peer));
- if (NULL != con_task)
- {
- GNUNET_SCHEDULER_cancel (con_task);
- con_task = NULL;
- }
pc->connect_status = 1;
if (pc == &p1)
{
};
-static void
-connect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
- {
- con_task = NULL;
- return;
- }
- con_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
- &connect_task,
- NULL);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Asking transport (1) to connect to peer `%4s'\n",
- GNUNET_i2s (&p2.id));
- GNUNET_TRANSPORT_try_connect (p1.th, &p2.id, NULL, NULL); /*FIXME TRY_CONNECT change */
-}
-
-
static void
init_notify (void *cls,
const struct GNUNET_PeerIdentity *my_identity)
GNUNET_assert (ok == 3);
OKPP;
GNUNET_assert (cls == &p2);
- con_task = GNUNET_SCHEDULER_add_now (&connect_task, NULL);
+ p1.ats_sh = GNUNET_ATS_connectivity_suggest (p1.ats,
+ &p2.id,
+ 1);
}
}
/*
This file is part of GNUnet.
- Copyright (C) 2009, 2010 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2009, 2010, 2015 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
static struct GNUNET_SCHEDULER_Task *err_task;
-static struct GNUNET_SCHEDULER_Task *connect_task;
-
struct PeerContext
{
terminate_peer (&p1);
terminate_peer (&p2);
- if (NULL != connect_task)
- {
- GNUNET_SCHEDULER_cancel (connect_task);
- connect_task = NULL;
- }
delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
FPRINTF (stderr,
"\nThroughput was %llu kb/s\n",
GNUNET_break (0);
terminate_peer (&p1);
terminate_peer (&p2);
- if (NULL != connect_task)
- {
- GNUNET_SCHEDULER_cancel (connect_task);
- connect_task = NULL;
- }
ok = 42;
}
-static void
-try_connect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- connect_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &try_connect,
- NULL);
- GNUNET_TRANSPORT_try_connect (p1.th, &p2.id, NULL, NULL); /*FIXME TRY_CONNECT change */
-}
-
-
static size_t
transmit_ready (void *cls, size_t size, void *buf)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Asking transport (1) to connect to peer `%s'\n",
GNUNET_i2s (&p2.id));
- connect_task = GNUNET_SCHEDULER_add_now (&try_connect, NULL);
+ p1.ats_sh = GNUNET_ATS_connectivity_suggest (p1.ats,
+ &p2.id,
+ 1);
}
}
static struct GNUNET_SCHEDULER_Task *measure_task;
-static struct GNUNET_SCHEDULER_Task *connect_task;
-
struct PeerContext
{
err_task = NULL;
terminate_peer (&p1);
terminate_peer (&p2);
- if (NULL != connect_task)
- {
- GNUNET_SCHEDULER_cancel (connect_task);
- connect_task = NULL;
- }
}
GNUNET_SCHEDULER_cancel (measure_task);
measure_task = NULL;
}
- if (NULL != connect_task)
- {
- GNUNET_SCHEDULER_cancel (connect_task);
- connect_task = NULL;
- }
ok = 42;
}
-static void
-try_connect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- connect_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &try_connect,
- NULL);
- GNUNET_TRANSPORT_try_connect (p1.th, &p2.id, NULL, NULL); /*FIXME TRY_CONNECT change */
- GNUNET_TRANSPORT_try_connect (p2.th, &p1.id, NULL, NULL); /*FIXME TRY_CONNECT change */
-}
-
-
/**
* Callback function to process statistic values.
*
OKPP;
GNUNET_assert (cls == &p2);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Asking core (1) to connect to peer `%4s'\n",
+ "Asking core (1) to connect to peer `%s' and vice-versa\n",
GNUNET_i2s (&p2.id));
- connect_task = GNUNET_SCHEDULER_add_now (&try_connect, NULL);
+ p1.ats_sh = GNUNET_ATS_connectivity_suggest (p1.ats,
+ &p2.id,
+ 1);
+ p2.ats_sh = GNUNET_ATS_connectivity_suggest (p2.ats,
+ &p1.id,
+ 1);
}
}