From d1c3036fd48f2645fab427df4a47d3bc69410d15 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 14 Nov 2010 13:31:59 +0000 Subject: [PATCH] more checks --- src/core/core_api.c | 16 ++++++++++++---- src/core/test_core_api.c | 35 ++++++++++++++++++++--------------- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/core/core_api.c b/src/core/core_api.c index 2211028fb..ffffbea92 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c @@ -819,10 +819,6 @@ main_notify_handler (void *cls, m = (const struct InitReplyMessage *) msg; GNUNET_break (0 == ntohl (m->reserved)); /* start our message processing loop */ -#if DEBUG_CORE - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Successfully connected to core service, starting processing loop.\n"); -#endif if (GNUNET_YES == h->currently_down) { h->currently_down = GNUNET_NO; @@ -837,8 +833,20 @@ main_notify_handler (void *cls, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &h->me.hashPubKey); +#if DEBUG_CORE + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Connected to core service of peer `%s'.\n", + GNUNET_i2s (&h->me)); +#endif init (h->cls, h, &h->me, &m->publicKey); } + else + { +#if DEBUG_CORE + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Successfully reconnected to core service.\n"); +#endif + } break; case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT: if (msize != sizeof (struct ConnectNotifyMessage)) diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index 004486525..4a8546bbe 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c @@ -34,7 +34,7 @@ #include "gnunet_scheduler_lib.h" #include "gnunet_transport_service.h" -#define VERBOSE GNUNET_NO +#define VERBOSE GNUNET_YES #define START_ARM GNUNET_YES @@ -123,25 +123,29 @@ connect_notify (void *cls, const struct GNUNET_TRANSPORT_ATS_Information *atsi) { struct PeerContext *pc = cls; + GNUNET_assert (pc->connect_status == 0); pc->connect_status = 1; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Encrypted connection established to peer `%4s'\n", - GNUNET_i2s (peer)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Asking core (1) for transmission to peer `%4s'\n", - GNUNET_i2s (&p2.id)); - if (NULL == GNUNET_CORE_notify_transmit_ready (p1.ch, - 0, - GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 45), - &p2.id, - sizeof (struct GNUNET_MessageHeader), - &transmit_ready, &p1)) + if (pc == &p1) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "RECEIVED NULL when asking core (1) for transmission to peer `%4s'\n", + "Encrypted connection established to peer `%4s'\n", + GNUNET_i2s (peer)); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Asking core (1) for transmission to peer `%4s'\n", GNUNET_i2s (&p2.id)); - } + if (NULL == GNUNET_CORE_notify_transmit_ready (p1.ch, + 0, + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 45), + &p2.id, + sizeof (struct GNUNET_MessageHeader), + &transmit_ready, &p1)) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "RECEIVED NULL when asking core (1) for transmission to peer `%4s'\n", + GNUNET_i2s (&p2.id)); + } + } } @@ -150,6 +154,7 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) { struct PeerContext *pc = cls; + pc->connect_status = 0; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypted connection to `%4s' cut\n", GNUNET_i2s (peer)); -- 2.25.1