gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r28235 - gnunet/src/set


From: gnunet
Subject: [GNUnet-SVN] r28235 - gnunet/src/set
Date: Mon, 22 Jul 2013 14:11:01 +0200

Author: dold
Date: 2013-07-22 14:11:01 +0200 (Mon, 22 Jul 2013)
New Revision: 28235

Modified:
   gnunet/src/set/set_api.c
Log:
- cancel uncommited set operation correctly


Modified: gnunet/src/set/set_api.c
===================================================================
--- gnunet/src/set/set_api.c    2013-07-22 08:32:56 UTC (rev 28234)
+++ gnunet/src/set/set_api.c    2013-07-22 12:11:01 UTC (rev 28235)
@@ -533,23 +533,25 @@
 void
 GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *oh)
 {
-  struct GNUNET_MQ_Envelope *mqm;
-  struct GNUNET_SET_OperationHandle *h_assoc;
+  if (NULL != oh->conclude_mqm)
+    GNUNET_MQ_discard (oh->conclude_mqm);
 
-  GNUNET_assert (NULL != oh->set);
+  /* is the operation still not commited? */
+  if (NULL != oh->set)
+  {
+    struct GNUNET_SET_OperationHandle *h_assoc;
+    struct GNUNET_MQ_Envelope *mqm;
 
-  GNUNET_CONTAINER_DLL_remove (oh->set->ops_head, oh->set->ops_tail, oh);
-  h_assoc = GNUNET_MQ_assoc_remove (oh->set->mq, oh->request_id);
-  GNUNET_assert (h_assoc == oh);
-  mqm = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_CANCEL);
-  GNUNET_MQ_send (oh->set->mq, mqm);
+    GNUNET_CONTAINER_DLL_remove (oh->set->ops_head, oh->set->ops_tail, oh);
+    h_assoc = GNUNET_MQ_assoc_remove (oh->set->mq, oh->request_id);
+    GNUNET_assert (h_assoc == oh);
+    mqm = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_CANCEL);
+    GNUNET_MQ_send (oh->set->mq, mqm);
 
-  if (NULL != oh->conclude_mqm)
-    GNUNET_MQ_discard (oh->conclude_mqm);
+    if (GNUNET_YES == oh->set->destroy_requested)
+      GNUNET_SET_destroy (oh->set);
+  }
 
-  if (GNUNET_YES == oh->set->destroy_requested)
-    GNUNET_SET_destroy (oh->set);
-
   GNUNET_free (oh);
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]