*/
static struct GNUNET_TIME_Relative exp_interval;
+/**
+ * Timeout task
+ */
+static struct GNUNET_SCHEDULER_Task *timeout;
+
static void
do_cleanup(void *cls)
{
+ if (NULL != timeout)
+ GNUNET_SCHEDULER_cancel (timeout);
+ if (NULL != idp_op)
+ GNUNET_IDENTITY_PROVIDER_cancel (idp_op);
if (NULL != attr_iterator)
GNUNET_IDENTITY_PROVIDER_get_attributes_stop (attr_iterator);
if (NULL != idp_handle)
const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket)
{
char* ticket_str;
+ idp_op = NULL;
if (NULL != ticket) {
ticket_str = GNUNET_STRINGS_data_to_string_alloc (ticket,
sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket));
int32_t success,
const char*emsg)
{
+ idp_op = NULL;
if (GNUNET_SYSERR == success) {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%s\n", emsg);
char *value_str;
if (NULL == identity)
{
+ idp_op = NULL;
GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
return;
}
GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
}
+static void
+timeout_task (void *cls)
+{
+ timeout = NULL;
+ ret = 1;
+ GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+ "Timeout\n");
+ GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
+}
+
static void
process_rvk (void *cls, int success, const char* msg)
{
+ idp_op = NULL;
if (GNUNET_OK != success)
{
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
&ticket,
&process_attrs,
NULL);
+ timeout = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10),
+ &timeout_task,
+ NULL);
return;
}
if (revoke_ticket)
GNUNET_GETOPT_OPTION_END
};
- if (GNUNET_OK == GNUNET_PROGRAM_run (argc, argv, "ct",
+ if (GNUNET_OK != GNUNET_PROGRAM_run (argc, argv, "ct",
"ct", options,
&run, NULL))
- return 0;
- else
return 1;
+ else
+ return ret;
}
static void
cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle)
{
+ struct ParallelLookup *lu;
+ struct ParallelLookup *tmp;
+ if (NULL != handle->lookup_request)
+ GNUNET_GNS_lookup_cancel (handle->lookup_request);
+ for (lu = handle->parallel_lookups_head;
+ NULL != lu;) {
+ GNUNET_GNS_lookup_cancel (lu->lookup_request);
+ GNUNET_free (lu->label);
+ tmp = lu->next;
+ GNUNET_CONTAINER_DLL_remove (handle->parallel_lookups_head,
+ handle->parallel_lookups_tail,
+ lu);
+ GNUNET_free (lu);
+ lu = tmp;
+ }
+
if (NULL != handle->key)
GNUNET_ABE_cpabe_delete_key (handle->key,
GNUNET_YES);
struct ParallelLookup *tmp;
struct AttributeResultMessage *arm;
struct GNUNET_MQ_Envelope *env;
-
+
+ handle->kill_task = NULL;
for (lu = handle->parallel_lookups_head;
NULL != lu;) {
GNUNET_GNS_lookup_cancel (lu->lookup_request);
GNUNET_CONTAINER_DLL_remove (h->op_head,
h->op_tail,
op);
- GNUNET_MQ_discard (op->env);
free_op (op);
}
which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
TEST_ATTR="test"
-gnunet-arm -s -c test_idp.conf
+gnunet-arm -s -c test_idp.conf 2&>1 > /dev/null
gnunet-identity -C alice -c test_idp.conf
gnunet-identity -C bob -c test_idp.conf
gnunet-identity -C eve -c test_idp.conf
BOB_KEY=$(gnunet-identity -d -c test_idp.conf | grep bob | awk '{print $3}')
EVE_KEY=$(gnunet-identity -d -c test_idp.conf | grep eve | awk '{print $3}')
-gnunet-idp -e alice -E 1s -a email -V john@doe.gnu -c test_idp.conf
-gnunet-idp -e alice -E 1s -a name -V John -c test_idp.conf
+gnunet-idp -e alice -E 15s -a email -V john@doe.gnu -c test_idp.conf
+gnunet-idp -e alice -E 15s -a name -V John -c test_idp.conf
TICKET_BOB=$(gnunet-idp -e alice -i "email,name" -r $BOB_KEY -c test_idp.conf | awk '{print $1}')
#gnunet-idp -e bob -C $TICKET_BOB -c test_idp.conf
TICKET_EVE=$(gnunet-idp -e alice -i "email" -r $EVE_KEY -c test_idp.conf | awk '{print $1}')
#gnunet-idp -e eve -C $TICKET_EVE -c test_idp.conf
gnunet-idp -e alice -R $TICKET_EVE -c test_idp.conf
-sleep 2
+#sleep 6
-gnunet-idp -e eve -C $TICKET_EVE -c test_idp.conf > /dev/null 2>&1
+gnunet-idp -e eve -C $TICKET_EVE -c test_idp.conf 2&>1 >/dev/null
if test $? == 0
then
echo "Eve can still resolve attributes..."
gnunet-arm -e -c test_idp.conf
exit 1
fi
-gnunet-idp -e bob -C $TICKET_BOB -c test_idp.conf > /dev/null 2>&1
+
+gnunet-arm -e -c test_idp.conf
+gnunet-arm -s -c test_idp.conf 2&>1 > /dev/null
+
+gnunet-idp -e bob -C $TICKET_BOB -c test_idp.conf 2&>1 >/dev/null
if test $? != 0
then
echo "Bob cannot resolve attributes..."