diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-06-20 20:12:52 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-06-20 20:12:52 +0000 |
commit | b55a742ce90f56f266f16172ccbc85180590b4b1 (patch) | |
tree | b4e737b8612681b35b5373f178ad9bc3ee42ea31 /src/core/core_api.c | |
parent | 38cd63a1e806124d19bdf478d9bfcdafe3bdccbb (diff) | |
download | gnunet-b55a742ce90f56f266f16172ccbc85180590b4b1.tar.gz gnunet-b55a742ce90f56f266f16172ccbc85180590b4b1.zip |
-tolerate init CB being NULL from the beginning
Diffstat (limited to 'src/core/core_api.c')
-rw-r--r-- | src/core/core_api.c | 20 |
1 files changed, 17 insertions, 3 deletions
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 | |||
215 | */ | 215 | */ |
216 | int currently_down; | 216 | int currently_down; |
217 | 217 | ||
218 | /** | ||
219 | * Did we ever get INIT? | ||
220 | */ | ||
221 | int have_init; | ||
222 | |||
218 | }; | 223 | }; |
219 | 224 | ||
220 | 225 | ||
@@ -359,6 +364,7 @@ handle_init_reply (void *cls, | |||
359 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 364 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
360 | "Connected to core service of peer `%s'.\n", | 365 | "Connected to core service of peer `%s'.\n", |
361 | GNUNET_i2s (&h->me)); | 366 | GNUNET_i2s (&h->me)); |
367 | h->have_init = GNUNET_YES; | ||
362 | init (h->cls, | 368 | init (h->cls, |
363 | &h->me); | 369 | &h->me); |
364 | } | 370 | } |
@@ -366,9 +372,17 @@ handle_init_reply (void *cls, | |||
366 | { | 372 | { |
367 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 373 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
368 | "Successfully reconnected to core service.\n"); | 374 | "Successfully reconnected to core service.\n"); |
369 | GNUNET_break (0 == memcmp (&h->me, | 375 | if (GNUNET_NO == h->have_init) |
370 | &m->my_identity, | 376 | { |
371 | sizeof (struct GNUNET_PeerIdentity))); | 377 | h->me = m->my_identity; |
378 | h->have_init = GNUNET_YES; | ||
379 | } | ||
380 | else | ||
381 | { | ||
382 | GNUNET_break (0 == memcmp (&h->me, | ||
383 | &m->my_identity, | ||
384 | sizeof (struct GNUNET_PeerIdentity))); | ||
385 | } | ||
372 | } | 386 | } |
373 | /* fake 'connect to self' */ | 387 | /* fake 'connect to self' */ |
374 | pr = GNUNET_new (struct PeerRecord); | 388 | pr = GNUNET_new (struct PeerRecord); |