diff options
author | Florian Dold <florian.dold@gmail.com> | 2013-07-22 12:11:01 +0000 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2013-07-22 12:11:01 +0000 |
commit | 78f8e587b93308c7ca1df8d0a17d4247b043c63d (patch) | |
tree | d7d824c2bcd430201f96933a36bb10a778516a19 | |
parent | 004225c9da181cbd771f36cefa962d89186b0366 (diff) | |
download | gnunet-78f8e587b93308c7ca1df8d0a17d4247b043c63d.tar.gz gnunet-78f8e587b93308c7ca1df8d0a17d4247b043c63d.zip |
- cancel uncommited set operation correctly
-rw-r--r-- | src/set/set_api.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/set/set_api.c b/src/set/set_api.c index b98f9fd92..b0d5dc8c1 100644 --- a/src/set/set_api.c +++ b/src/set/set_api.c | |||
@@ -533,22 +533,24 @@ GNUNET_SET_accept (struct GNUNET_SET_Request *request, | |||
533 | void | 533 | void |
534 | GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *oh) | 534 | GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *oh) |
535 | { | 535 | { |
536 | struct GNUNET_MQ_Envelope *mqm; | ||
537 | struct GNUNET_SET_OperationHandle *h_assoc; | ||
538 | |||
539 | GNUNET_assert (NULL != oh->set); | ||
540 | |||
541 | GNUNET_CONTAINER_DLL_remove (oh->set->ops_head, oh->set->ops_tail, oh); | ||
542 | h_assoc = GNUNET_MQ_assoc_remove (oh->set->mq, oh->request_id); | ||
543 | GNUNET_assert (h_assoc == oh); | ||
544 | mqm = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_CANCEL); | ||
545 | GNUNET_MQ_send (oh->set->mq, mqm); | ||
546 | |||
547 | if (NULL != oh->conclude_mqm) | 536 | if (NULL != oh->conclude_mqm) |
548 | GNUNET_MQ_discard (oh->conclude_mqm); | 537 | GNUNET_MQ_discard (oh->conclude_mqm); |
549 | 538 | ||
550 | if (GNUNET_YES == oh->set->destroy_requested) | 539 | /* is the operation still not commited? */ |
551 | GNUNET_SET_destroy (oh->set); | 540 | if (NULL != oh->set) |
541 | { | ||
542 | struct GNUNET_SET_OperationHandle *h_assoc; | ||
543 | struct GNUNET_MQ_Envelope *mqm; | ||
544 | |||
545 | GNUNET_CONTAINER_DLL_remove (oh->set->ops_head, oh->set->ops_tail, oh); | ||
546 | h_assoc = GNUNET_MQ_assoc_remove (oh->set->mq, oh->request_id); | ||
547 | GNUNET_assert (h_assoc == oh); | ||
548 | mqm = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_CANCEL); | ||
549 | GNUNET_MQ_send (oh->set->mq, mqm); | ||
550 | |||
551 | if (GNUNET_YES == oh->set->destroy_requested) | ||
552 | GNUNET_SET_destroy (oh->set); | ||
553 | } | ||
552 | 554 | ||
553 | GNUNET_free (oh); | 555 | GNUNET_free (oh); |
554 | } | 556 | } |