[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r36368 - in gnunet/src: include set
From: |
gnunet |
Subject: |
[GNUnet-SVN] r36368 - in gnunet/src: include set |
Date: |
Tue, 22 Sep 2015 03:47:37 +0200 |
Author: dold
Date: 2015-09-22 03:47:36 +0200 (Tue, 22 Sep 2015)
New Revision: 36368
Modified:
gnunet/src/include/gnunet_set_service.h
gnunet/src/set/gnunet-service-set_union.c
gnunet/src/set/gnunet-set-profiler.c
gnunet/src/set/set_api.c
Log:
set api changes
Modified: gnunet/src/include/gnunet_set_service.h
===================================================================
--- gnunet/src/include/gnunet_set_service.h 2015-09-22 01:20:28 UTC (rev
36367)
+++ gnunet/src/include/gnunet_set_service.h 2015-09-22 01:47:36 UTC (rev
36368)
@@ -99,10 +99,33 @@
* Everything went ok, we are transmitting an element of the
* result (in set, or to be removed from set, depending on
* the `enum GNUNET_SET_ResultMode`).
+ *
+ * Only applies to
+ * #GNUNET_SET_RESULT_FULL,
+ * #GNUNET_SET_RESULT_ADDED,
+ * #GNUNET_SET_RESULT_REMOVED,
*/
GNUNET_SET_STATUS_OK,
/**
+ * Element should be added to the result set
+ * of the local peer, i.e. the local peer is
+ * missing an element.
+ *
+ * Only applies to #GNUNET_SET_RESULT_SYMMETRIC
+ */
+ GNUNET_SET_STATUS_ADD_LOCAL,
+
+ /**
+ * Element should be added to the result set
+ * of the remove peer, i.e. the remote peer is
+ * missing an element.
+ *
+ * Only applies to #GNUNET_SET_RESULT_SYMMETRIC
+ */
+ GNUNET_SET_STATUS_ADD_REMOTE,
+
+ /**
* The other peer refused to to the operation with us,
* or something went wrong.
*/
@@ -129,20 +152,32 @@
{
/**
* Client gets every element in the resulting set.
+ *
+ * Only supported for set intersection.
*/
GNUNET_SET_RESULT_FULL,
/**
- * Client gets only elements that have been added to the set.
- * Only works with set union.
+ * Client gets notified of the required changes
+ * for both the local and the remote set.
+ *
+ * Only supported for set
*/
- GNUNET_SET_RESULT_ADDED,
+ GNUNET_SET_RESULT_SYMMETRIC,
/**
* Client gets only elements that have been removed from the set.
- * Only works with set intersection.
+ *
+ * Only supported for set intersection.
*/
- GNUNET_SET_RESULT_REMOVED
+ GNUNET_SET_RESULT_REMOVED,
+
+ /**
+ * Client gets only elements that have been removed from the set.
+ *
+ * Only supported for set union.
+ */
+ GNUNET_SET_RESULT_ADDED
};
Modified: gnunet/src/set/gnunet-service-set_union.c
===================================================================
--- gnunet/src/set/gnunet-service-set_union.c 2015-09-22 01:20:28 UTC (rev
36367)
+++ gnunet/src/set/gnunet-service-set_union.c 2015-09-22 01:47:36 UTC (rev
36368)
@@ -1003,7 +1003,12 @@
GNUNET_break (0);
return;
}
- rm->result_status = htons (GNUNET_SET_STATUS_OK);
+
+ if (GNUNET_SET_RESULT_ADDED == op->spec->result_mode)
+ rm->result_status = htons (GNUNET_SET_STATUS_OK);
+ else if (GNUNET_SET_RESULT_SYMMETRIC == op->spec->result_mode)
+ rm->result_status = htons (GNUNET_SET_STATUS_ADD_LOCAL);
+
rm->request_id = htonl (op->spec->client_request_id);
rm->element_type = element->element_type;
memcpy (&rm[1], element->data, element->size);
@@ -1167,7 +1172,7 @@
op_register_element (op, ee);
/* only send results immediately if the client wants it */
- if (GNUNET_SET_RESULT_ADDED == op->spec->result_mode)
+ if (GNUNET_SET_RESULT_FULL != op->spec->result_mode)
send_client_element (op, &ee->element);
}
Modified: gnunet/src/set/gnunet-set-profiler.c
===================================================================
--- gnunet/src/set/gnunet-set-profiler.c 2015-09-22 01:20:28 UTC (rev
36367)
+++ gnunet/src/set/gnunet-set-profiler.c 2015-09-22 01:47:36 UTC (rev
36368)
@@ -150,7 +150,7 @@
GNUNET_assert (NULL == info2.oh);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"set listen cb called\n");
- info2.oh = GNUNET_SET_accept (request, GNUNET_SET_RESULT_ADDED,
+ info2.oh = GNUNET_SET_accept (request, GNUNET_SET_RESULT_SYMMETRIC,
set_result_cb, &info2);
GNUNET_SET_commit (info2.oh, info2.set);
}
@@ -273,7 +273,7 @@
&app_id, set_listen_cb, NULL);
info1.oh = GNUNET_SET_prepare (&local_peer, &app_id, NULL,
- GNUNET_SET_RESULT_ADDED,
+ GNUNET_SET_RESULT_SYMMETRIC,
set_result_cb, &info1);
GNUNET_SET_commit (info1.oh, info1.set);
GNUNET_SET_destroy (info1.set);
Modified: gnunet/src/set/set_api.c
===================================================================
--- gnunet/src/set/set_api.c 2015-09-22 01:20:28 UTC (rev 36367)
+++ gnunet/src/set/set_api.c 2015-09-22 01:47:36 UTC (rev 36368)
@@ -417,6 +417,8 @@
switch (result_status)
{
case GNUNET_SET_STATUS_OK:
+ case GNUNET_SET_STATUS_ADD_LOCAL:
+ case GNUNET_SET_STATUS_ADD_REMOTE:
break;
case GNUNET_SET_STATUS_FAILURE:
oh->result_cb = NULL;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r36368 - in gnunet/src: include set,
gnunet <=