aboutsummaryrefslogtreecommitdiff
path: root/src/set/set_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-11 18:15:38 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-11 18:15:38 +0100
commitabdec5e11ff11bb10d32c013e11344a54786f80f (patch)
treec2b8eb6705efa8ac8278a6024d8ab19222471f0e /src/set/set_api.c
parent4e981fb2bd74f21c33adf05d7999b05704d6909b (diff)
downloadgnunet-abdec5e11ff11bb10d32c013e11344a54786f80f.tar.gz
gnunet-abdec5e11ff11bb10d32c013e11344a54786f80f.zip
cleaning up set handlers, eliminating 2nd level demultiplexing and improving use of types
Diffstat (limited to 'src/set/set_api.c')
-rw-r--r--src/set/set_api.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/set/set_api.c b/src/set/set_api.c
index 04a4e4910..bc428f9f6 100644
--- a/src/set/set_api.c
+++ b/src/set/set_api.c
@@ -76,6 +76,8 @@ struct GNUNET_SET_Handle
76 76
77 /** 77 /**
78 * Should the set be destroyed once all operations are gone? 78 * Should the set be destroyed once all operations are gone?
79 * #GNUNET_SYSERR if #GNUNET_SET_destroy() must raise this flag,
80 * #GNUNET_YES if #GNUNET_SET_destroy() did raise this flag.
79 */ 81 */
80 int destroy_requested; 82 int destroy_requested;
81 83
@@ -345,11 +347,13 @@ handle_iter_done (void *cls,
345 347
346 if (NULL == iter) 348 if (NULL == iter)
347 return; 349 return;
350 set->destroy_requested = GNUNET_SYSERR;
348 set->iterator = NULL; 351 set->iterator = NULL;
349 set->iteration_id++; 352 set->iteration_id++;
350 iter (set->iterator_cls, 353 iter (set->iterator_cls,
351 NULL); 354 NULL);
352 355 if (GNUNET_SYSERR == set->destroy_requested)
356 set->destroy_requested = GNUNET_NO;
353 if (GNUNET_YES == set->destroy_requested) 357 if (GNUNET_YES == set->destroy_requested)
354 GNUNET_SET_destroy (set); 358 GNUNET_SET_destroy (set);
355} 359}
@@ -736,7 +740,9 @@ GNUNET_SET_destroy (struct GNUNET_SET_Handle *set)
736 /* destroying set while iterator is active is currently 740 /* destroying set while iterator is active is currently
737 not supported; we should expand the API to allow 741 not supported; we should expand the API to allow
738 clients to explicitly cancel the iteration! */ 742 clients to explicitly cancel the iteration! */
739 if ( (NULL != set->ops_head) || (NULL != set->iterator) ) 743 if ( (NULL != set->ops_head) ||
744 (NULL != set->iterator) ||
745 (GNUNET_SYSERR == set->destroy_requested) )
740 { 746 {
741 LOG (GNUNET_ERROR_TYPE_DEBUG, 747 LOG (GNUNET_ERROR_TYPE_DEBUG,
742 "Set operations are pending, delaying set destruction\n"); 748 "Set operations are pending, delaying set destruction\n");
@@ -809,7 +815,7 @@ GNUNET_SET_prepare (const struct GNUNET_PeerIdentity *other_peer,
809 msg->force_delta = GNUNET_YES; 815 msg->force_delta = GNUNET_YES;
810 break; 816 break;
811 default: 817 default:
812 LOG (GNUNET_ERROR_TYPE_ERROR, 818 LOG (GNUNET_ERROR_TYPE_ERROR,
813 "Option with type %d not recognized\n", (int) opt->type); 819 "Option with type %d not recognized\n", (int) opt->type);
814 } 820 }
815 } 821 }