aboutsummaryrefslogtreecommitdiff
path: root/src/set
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-08-09 16:43:47 +0200
committerChristian Grothoff <christian@grothoff.org>2018-08-09 16:43:47 +0200
commit5b7ed686d4a6c4ecb8e0302a42e85bb9bff42cac (patch)
treea0f042cf8afdaa3fb57ba142990297c9a68ca9bb /src/set
parent7caba06019ecc5775d3dbb513b70f52f620affb5 (diff)
parentc1d682ec363c5cb4e8fdca5ee9b4dd8eaff29204 (diff)
downloadgnunet-5b7ed686d4a6c4ecb8e0302a42e85bb9bff42cac.tar.gz
gnunet-5b7ed686d4a6c4ecb8e0302a42e85bb9bff42cac.zip
merge
Diffstat (limited to 'src/set')
-rw-r--r--src/set/gnunet-service-set_intersection.c19
-rw-r--r--src/set/gnunet-service-set_union.c39
2 files changed, 52 insertions, 6 deletions
diff --git a/src/set/gnunet-service-set_intersection.c b/src/set/gnunet-service-set_intersection.c
index 254763b45..1083384f5 100644
--- a/src/set/gnunet-service-set_intersection.c
+++ b/src/set/gnunet-service-set_intersection.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -23,6 +23,7 @@
23 */ 23 */
24#include "platform.h" 24#include "platform.h"
25#include "gnunet_util_lib.h" 25#include "gnunet_util_lib.h"
26#include "gnunet_statistics_service.h"
26#include "gnunet-service-set.h" 27#include "gnunet-service-set.h"
27#include "gnunet_block_lib.h" 28#include "gnunet_block_lib.h"
28#include "gnunet-service-set_protocol.h" 29#include "gnunet-service-set_protocol.h"
@@ -215,6 +216,10 @@ send_client_removed_element (struct Operation *op,
215 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 216 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
216 "Sending removed element (size %u) to client\n", 217 "Sending removed element (size %u) to client\n",
217 element->size); 218 element->size);
219 GNUNET_STATISTICS_update (_GSS_statistics,
220 "# Element removed messages sent",
221 1,
222 GNUNET_NO);
218 GNUNET_assert (0 != op->client_request_id); 223 GNUNET_assert (0 != op->client_request_id);
219 ev = GNUNET_MQ_msg_extra (rm, 224 ev = GNUNET_MQ_msg_extra (rm,
220 element->size, 225 element->size,
@@ -406,6 +411,10 @@ fail_intersection_operation (struct Operation *op)
406 411
407 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 412 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
408 "Intersection operation failed\n"); 413 "Intersection operation failed\n");
414 GNUNET_STATISTICS_update (_GSS_statistics,
415 "# Intersection operations failed",
416 1,
417 GNUNET_NO);
409 if (NULL != op->state->my_elements) 418 if (NULL != op->state->my_elements)
410 { 419 {
411 GNUNET_CONTAINER_multihashmap_destroy (op->state->my_elements); 420 GNUNET_CONTAINER_multihashmap_destroy (op->state->my_elements);
@@ -466,6 +475,10 @@ send_bloomfilter (struct Operation *op)
466 op); 475 op);
467 476
468 /* send our Bloom filter */ 477 /* send our Bloom filter */
478 GNUNET_STATISTICS_update (_GSS_statistics,
479 "# Intersection Bloom filters sent",
480 1,
481 GNUNET_NO);
469 chunk_size = 60 * 1024 - sizeof (struct BFMessage); 482 chunk_size = 60 * 1024 - sizeof (struct BFMessage);
470 if (bf_size <= chunk_size) 483 if (bf_size <= chunk_size)
471 { 484 {
@@ -534,6 +547,10 @@ send_client_done_and_destroy (void *cls)
534 547
535 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 548 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
536 "Intersection succeeded, sending DONE to local client\n"); 549 "Intersection succeeded, sending DONE to local client\n");
550 GNUNET_STATISTICS_update (_GSS_statistics,
551 "# Intersection operations succeeded",
552 1,
553 GNUNET_NO);
537 ev = GNUNET_MQ_msg (rm, 554 ev = GNUNET_MQ_msg (rm,
538 GNUNET_MESSAGE_TYPE_SET_RESULT); 555 GNUNET_MESSAGE_TYPE_SET_RESULT);
539 rm->request_id = htonl (op->client_request_id); 556 rm->request_id = htonl (op->client_request_id);
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index 8c0c52d64..73d3f5c83 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -758,8 +758,8 @@ get_order_from_difference (unsigned int diff)
758 */ 758 */
759static int 759static int
760send_full_element_iterator (void *cls, 760send_full_element_iterator (void *cls,
761 const struct GNUNET_HashCode *key, 761 const struct GNUNET_HashCode *key,
762 void *value) 762 void *value)
763{ 763{
764 struct Operation *op = cls; 764 struct Operation *op = cls;
765 struct GNUNET_SET_ElementMessage *emsg; 765 struct GNUNET_SET_ElementMessage *emsg;
@@ -1367,6 +1367,26 @@ send_client_element (struct Operation *op,
1367 1367
1368 1368
1369/** 1369/**
1370 * Destroy remote channel.
1371 *
1372 * @param op operation
1373 */
1374static void
1375destroy_channel (struct Operation *op)
1376{
1377 struct GNUNET_CADET_Channel *channel;
1378
1379 if (NULL != (channel = op->channel))
1380 {
1381 /* This will free op; called conditionally as this helper function
1382 is also called from within the channel disconnect handler. */
1383 op->channel = NULL;
1384 GNUNET_CADET_channel_destroy (channel);
1385 }
1386}
1387
1388
1389/**
1370 * Signal to the client that the operation has finished and 1390 * Signal to the client that the operation has finished and
1371 * destroy the operation. 1391 * destroy the operation.
1372 * 1392 *
@@ -1379,13 +1399,18 @@ send_client_done (void *cls)
1379 struct GNUNET_MQ_Envelope *ev; 1399 struct GNUNET_MQ_Envelope *ev;
1380 struct GNUNET_SET_ResultMessage *rm; 1400 struct GNUNET_SET_ResultMessage *rm;
1381 1401
1382 if (GNUNET_YES == op->state->client_done_sent) { 1402 if (GNUNET_YES == op->state->client_done_sent)
1403 {
1383 return; 1404 return;
1384 } 1405 }
1385 1406
1386 if (PHASE_DONE != op->state->phase) { 1407 if (PHASE_DONE != op->state->phase) {
1387 LOG (GNUNET_ERROR_TYPE_WARNING, 1408 LOG (GNUNET_ERROR_TYPE_WARNING,
1388 "union operation failed\n"); 1409 "Union operation failed\n");
1410 GNUNET_STATISTICS_update (_GSS_statistics,
1411 "# Union operations failed",
1412 1,
1413 GNUNET_NO);
1389 ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT); 1414 ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT);
1390 rm->result_status = htons (GNUNET_SET_STATUS_FAILURE); 1415 rm->result_status = htons (GNUNET_SET_STATUS_FAILURE);
1391 rm->request_id = htonl (op->client_request_id); 1416 rm->request_id = htonl (op->client_request_id);
@@ -1397,6 +1422,10 @@ send_client_done (void *cls)
1397 1422
1398 op->state->client_done_sent = GNUNET_YES; 1423 op->state->client_done_sent = GNUNET_YES;
1399 1424
1425 GNUNET_STATISTICS_update (_GSS_statistics,
1426 "# Union operations succeeded",
1427 1,
1428 GNUNET_NO);
1400 LOG (GNUNET_ERROR_TYPE_INFO, 1429 LOG (GNUNET_ERROR_TYPE_INFO,
1401 "Signalling client that union operation is done\n"); 1430 "Signalling client that union operation is done\n");
1402 ev = GNUNET_MQ_msg (rm, 1431 ev = GNUNET_MQ_msg (rm,