From 5aade75659784566c4f8e3b554d98da3dfd09fd2 Mon Sep 17 00:00:00 2001 From: LRN Date: Sun, 15 Sep 2013 07:24:52 +0000 Subject: Fix the endless loop fix - don't miss pre-last item --- src/identity/identity_api.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/identity/identity_api.c') diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index 2b4ed465b..1530aff39 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c @@ -879,8 +879,9 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id, * the operation. * * @param op operation to cancel + * @return GNUNET_YES if the continuation was cancelled */ -void +int GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op) { struct GNUNET_IDENTITY_Handle *h = op->h; @@ -893,7 +894,7 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op) h->op_tail, op); GNUNET_free (op); - return; + return GNUNET_YES; } if (NULL != h->th) { @@ -905,11 +906,12 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op) op); GNUNET_free (op); transmit_next (h); - return; + return GNUNET_YES; } /* request active with service, simply ensure continuations are not called */ op->cont = NULL; op->cb = NULL; + return GNUNET_NO; } @@ -952,8 +954,9 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h) struct GNUNET_IDENTITY_Operation *op; GNUNET_assert (NULL != h); - while ((NULL != (op = h->op_head) && (NULL != op->next))) - GNUNET_IDENTITY_cancel (op); + while (NULL != (op = h->op_head)) + if (GNUNET_YES != GNUNET_IDENTITY_cancel (op)) + break; if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (h->reconnect_task); -- cgit v1.2.3