aboutsummaryrefslogtreecommitdiff
path: root/src/identity/identity_api.c
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-09-15 07:24:52 +0000
committerLRN <lrn1986@gmail.com>2013-09-15 07:24:52 +0000
commit5aade75659784566c4f8e3b554d98da3dfd09fd2 (patch)
tree765f4f292a05d55dc445bb171cc22b812517cb5d /src/identity/identity_api.c
parenta005768848df59c4535bf83f8452d3b0b54baace (diff)
downloadgnunet-5aade75659784566c4f8e3b554d98da3dfd09fd2.tar.gz
gnunet-5aade75659784566c4f8e3b554d98da3dfd09fd2.zip
Fix the endless loop fix - don't miss pre-last item
Diffstat (limited to 'src/identity/identity_api.c')
-rw-r--r--src/identity/identity_api.c13
1 files changed, 8 insertions, 5 deletions
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,
879 * the operation. 879 * the operation.
880 * 880 *
881 * @param op operation to cancel 881 * @param op operation to cancel
882 * @return GNUNET_YES if the continuation was cancelled
882 */ 883 */
883void 884int
884GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op) 885GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op)
885{ 886{
886 struct GNUNET_IDENTITY_Handle *h = op->h; 887 struct GNUNET_IDENTITY_Handle *h = op->h;
@@ -893,7 +894,7 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op)
893 h->op_tail, 894 h->op_tail,
894 op); 895 op);
895 GNUNET_free (op); 896 GNUNET_free (op);
896 return; 897 return GNUNET_YES;
897 } 898 }
898 if (NULL != h->th) 899 if (NULL != h->th)
899 { 900 {
@@ -905,11 +906,12 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op)
905 op); 906 op);
906 GNUNET_free (op); 907 GNUNET_free (op);
907 transmit_next (h); 908 transmit_next (h);
908 return; 909 return GNUNET_YES;
909 } 910 }
910 /* request active with service, simply ensure continuations are not called */ 911 /* request active with service, simply ensure continuations are not called */
911 op->cont = NULL; 912 op->cont = NULL;
912 op->cb = NULL; 913 op->cb = NULL;
914 return GNUNET_NO;
913} 915}
914 916
915 917
@@ -952,8 +954,9 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h)
952 struct GNUNET_IDENTITY_Operation *op; 954 struct GNUNET_IDENTITY_Operation *op;
953 955
954 GNUNET_assert (NULL != h); 956 GNUNET_assert (NULL != h);
955 while ((NULL != (op = h->op_head) && (NULL != op->next))) 957 while (NULL != (op = h->op_head))
956 GNUNET_IDENTITY_cancel (op); 958 if (GNUNET_YES != GNUNET_IDENTITY_cancel (op))
959 break;
957 if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK) 960 if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK)
958 { 961 {
959 GNUNET_SCHEDULER_cancel (h->reconnect_task); 962 GNUNET_SCHEDULER_cancel (h->reconnect_task);