From: Christian Grothoff Date: Mon, 20 Jun 2016 20:12:52 +0000 (+0000) Subject: -tolerate init CB being NULL from the beginning X-Git-Tag: initial-import-from-subversion-38251~754 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b55a742ce90f56f266f16172ccbc85180590b4b1;p=oweals%2Fgnunet.git -tolerate init CB being NULL from the beginning --- diff --git a/src/core/core_api.c b/src/core/core_api.c index b7fe812f8..7699f8b74 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c @@ -215,6 +215,11 @@ struct GNUNET_CORE_Handle */ int currently_down; + /** + * Did we ever get INIT? + */ + int have_init; + }; @@ -359,6 +364,7 @@ handle_init_reply (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, "Connected to core service of peer `%s'.\n", GNUNET_i2s (&h->me)); + h->have_init = GNUNET_YES; init (h->cls, &h->me); } @@ -366,9 +372,17 @@ handle_init_reply (void *cls, { LOG (GNUNET_ERROR_TYPE_DEBUG, "Successfully reconnected to core service.\n"); - GNUNET_break (0 == memcmp (&h->me, - &m->my_identity, - sizeof (struct GNUNET_PeerIdentity))); + if (GNUNET_NO == h->have_init) + { + h->me = m->my_identity; + h->have_init = GNUNET_YES; + } + else + { + GNUNET_break (0 == memcmp (&h->me, + &m->my_identity, + sizeof (struct GNUNET_PeerIdentity))); + } } /* fake 'connect to self' */ pr = GNUNET_new (struct PeerRecord);