/*
This file is part of GNUnet.
- Copyright (C) 2009, 2013 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2009, 2013, 2016 GNUnet e.V.
- GNUnet is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Affero General Public License for more details.
*/
/**
* @file revocation/test_revocation.c
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
- unsigned int c;
-
- for (c = 0; c < NUM_TEST_PEERS; c++)
+ for (unsigned int c = 0; c < NUM_TEST_PEERS; c++)
{
if (NULL != testpeers[c].create_id_op)
{
static void
-check_revocation (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+check_revocation (void *cls);
static void
if (GNUNET_NO == is_valid)
{
- fprintf (stderr,
- "Local revocation successful\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Local revocation successful\n");
ok = 0;
GNUNET_SCHEDULER_shutdown ();
return;
NULL);
return;
}
- fprintf (stderr,
- "Flooding of revocation failed\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Flooding of revocation failed\n");
ok = 2;
GNUNET_SCHEDULER_shutdown ();
}
static void
-check_revocation (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+check_revocation (void *cls)
{
GNUNET_REVOCATION_query (testpeers[0].cfg,
&testpeers[1].pubkey,
testpeers[1].revok_handle = NULL;
if (GNUNET_NO == is_valid)
{
- fprintf (stderr,
- "Revocation successful\n");
- check_revocation (NULL, NULL);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Revocation successful\n");
+ check_revocation (NULL);
}
}
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct TestPeer *me = cls;
+
me->cfg = cfg;
- me->idh = GNUNET_IDENTITY_connect (cfg, NULL, NULL );
+ me->idh = GNUNET_IDENTITY_connect (cfg, NULL, NULL);
if (NULL == me->idh)
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- "Failed to create IDENTITY handle \n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to create IDENTITY handle \n");
return me->idh;
}
}
-static void
+static void *
connect_cb (void *cls,
- const struct GNUNET_PeerIdentity *peer)
+ const struct GNUNET_PeerIdentity *peer,
+ struct GNUNET_MQ_Handle *mq)
{
static int connects = 0;
&identity_disconnect_adapter,
&testpeers[1]);
}
+ return NULL;
}
struct TestPeer *me = cls;
me->cfg = cfg;
- me->ch = GNUNET_CORE_connect (cfg, me, NULL,
- &connect_cb, NULL,
- NULL, GNUNET_NO,
- NULL, GNUNET_NO,
+ me->ch = GNUNET_CORE_connect (cfg,
+ me,
+ NULL,
+ &connect_cb,
+ NULL,
NULL);
if (NULL == me->ch)
GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
{
unsigned int c;
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
- &do_shutdown, NULL);
-
+ GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
+ NULL);
if (NUM_TEST_PEERS != num_peers)
{
ok = 4;
/* We are generating a CLIQUE */
if (NUM_TEST_PEERS * (NUM_TEST_PEERS -1) == links_succeeded)
{
- fprintf (stderr,
- "Testbed connected peers, initializing test\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Testbed connected peers, initializing test\n");
for (c = 0; c < num_peers; c++)
{
testpeers[c].p = peers[c];
}
else
{
- fprintf (stderr,
- "Testbed failed to connect peers\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Testbed failed to connect peers\n");
ok = 5;
GNUNET_SCHEDULER_shutdown ();
return;