/*
This file is part of GNUnet.
- Copyright (C) 2013 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2013 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
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.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
#include "platform.h"
/**
* Has the test been successful?
*/
-int result;
+static int result;
-unsigned int num_received;
+static unsigned int num_received;
-struct GNUNET_CORE_Handle *core;
+static struct GNUNET_CORE_Handle *core;
-struct GNUNET_MQ_Handle *mq;
+static struct GNUNET_MQ_Handle *mq;
-struct GNUNET_PeerIdentity myself;
+static struct GNUNET_PeerIdentity myself;
static void
static void
-connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer)
+connect_cb (void *cls,
+ const struct GNUNET_PeerIdentity *peer)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected to peer %s.\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Connected to peer %s.\n",
GNUNET_i2s (peer));
if (0 == memcmp (peer, &myself, sizeof (struct GNUNET_PeerIdentity)))
{
unsigned int i;
struct GNUNET_MQ_Envelope *ev;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Queueing messages.\n");
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Queueing messages.\n");
for (i = 0; i < NUM_MSG; i++)
{
ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_TEST);
const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got test message %d\n", num_received);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Got test message %d\n",
+ num_received);
num_received++;
if (NUM_MSG == num_received)
{
}
if (num_received > NUM_MSG)
{
- GNUNET_abort ();
+ GNUNET_assert (0);
return GNUNET_SYSERR;
}
return GNUNET_OK;
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Shutting down\n");
GNUNET_MQ_destroy (mq);
GNUNET_CORE_disconnect (core);
}
GNUNET_NO, handlers);
if (NULL == core)
{
- GNUNET_abort ();
+ GNUNET_assert (0);
return;
}
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL);
+ GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
}
+
int
main (int argc, char *argv1[])
{