aboutsummaryrefslogtreecommitdiff
path: root/src/set/gnunet-service-set.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/set/gnunet-service-set.c')
-rw-r--r--src/set/gnunet-service-set.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index 666ba5b1b..452ded8a3 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2013 Christian Grothoff (and other contributing authors) 3 (C) 2013, 2014 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -17,11 +17,11 @@
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20
21/** 20/**
22 * @file set/gnunet-service-set.c 21 * @file set/gnunet-service-set.c
23 * @brief two-peer set operations 22 * @brief two-peer set operations
24 * @author Florian Dold 23 * @author Florian Dold
24 * @author Christian Grothoff
25 */ 25 */
26#include "gnunet-service-set.h" 26#include "gnunet-service-set.h"
27#include "set_protocol.h" 27#include "set_protocol.h"
@@ -629,7 +629,8 @@ handle_incoming_msg (struct Operation *op,
629 spec->context_msg = GNUNET_copy_message (spec->context_msg); 629 spec->context_msg = GNUNET_copy_message (spec->context_msg);
630 spec->operation = ntohl (msg->operation); 630 spec->operation = ntohl (msg->operation);
631 spec->app_id = msg->app_id; 631 spec->app_id = msg->app_id;
632 spec->salt = ntohl (msg->salt); 632 spec->salt = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
633 UINT32_MAX);
633 spec->peer = op->state->peer; 634 spec->peer = op->state->peer;
634 spec->remote_element_count = ntohl (msg->element_count); 635 spec->remote_element_count = ntohl (msg->element_count);
635 636
@@ -729,7 +730,8 @@ handle_client_iterate (void *cls,
729 GNUNET_SERVER_client_disconnect (client); 730 GNUNET_SERVER_client_disconnect (client);
730 return; 731 return;
731 } 732 }
732 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "iterating union set with %u elements\n", 733 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
734 "iterating union set with %u elements\n",
733 GNUNET_CONTAINER_multihashmap_size (set->elements)); 735 GNUNET_CONTAINER_multihashmap_size (set->elements));
734 GNUNET_SERVER_receive_done (client, GNUNET_OK); 736 GNUNET_SERVER_receive_done (client, GNUNET_OK);
735 set->iter = GNUNET_CONTAINER_multihashmap_iterator_create (set->elements); 737 set->iter = GNUNET_CONTAINER_multihashmap_iterator_create (set->elements);
@@ -767,7 +769,7 @@ handle_client_create_set (void *cls,
767 769
768 set = GNUNET_new (struct Set); 770 set = GNUNET_new (struct Set);
769 771
770 switch (ntohs (msg->operation)) 772 switch (ntohl (msg->operation))
771 { 773 {
772 case GNUNET_SET_OPERATION_INTERSECTION: 774 case GNUNET_SET_OPERATION_INTERSECTION:
773 set->vt = _GSS_intersection_vt (); 775 set->vt = _GSS_intersection_vt ();
@@ -875,9 +877,9 @@ handle_client_reject (void *cls,
875 const struct GNUNET_MessageHeader *m) 877 const struct GNUNET_MessageHeader *m)
876{ 878{
877 struct Operation *incoming; 879 struct Operation *incoming;
878 const struct GNUNET_SET_AcceptRejectMessage *msg; 880 const struct GNUNET_SET_RejectMessage *msg;
879 881
880 msg = (const struct GNUNET_SET_AcceptRejectMessage *) m; 882 msg = (const struct GNUNET_SET_RejectMessage *) m;
881 GNUNET_break (0 == ntohl (msg->request_id)); 883 GNUNET_break (0 == ntohl (msg->request_id));
882 884
883 // no matching incoming operation for this reject 885 // no matching incoming operation for this reject
@@ -1143,10 +1145,10 @@ handle_client_accept (void *cls,
1143 const struct GNUNET_MessageHeader *mh) 1145 const struct GNUNET_MessageHeader *mh)
1144{ 1146{
1145 struct Set *set; 1147 struct Set *set;
1146 const struct GNUNET_SET_AcceptRejectMessage *msg; 1148 const struct GNUNET_SET_AcceptMessage *msg;
1147 struct Operation *op; 1149 struct Operation *op;
1148 1150
1149 msg = (const struct GNUNET_SET_AcceptRejectMessage *) mh; 1151 msg = (const struct GNUNET_SET_AcceptMessage *) mh;
1150 1152
1151 // client without a set requested an operation 1153 // client without a set requested an operation
1152 set = set_get (client); 1154 set = set_get (client);
@@ -1201,7 +1203,7 @@ handle_client_accept (void *cls,
1201 op); 1203 op);
1202 1204
1203 op->spec->client_request_id = ntohl (msg->request_id); 1205 op->spec->client_request_id = ntohl (msg->request_id);
1204 op->spec->result_mode = ntohs (msg->result_mode); 1206 op->spec->result_mode = ntohl (msg->result_mode);
1205 op->generation_created = set->current_generation++; 1207 op->generation_created = set->current_generation++;
1206 op->vt = op->spec->set->vt; 1208 op->vt = op->spec->set->vt;
1207 GNUNET_assert (NULL != op->vt->accept); 1209 GNUNET_assert (NULL != op->vt->accept);
@@ -1446,7 +1448,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1446{ 1448{
1447 static const struct GNUNET_SERVER_MessageHandler server_handlers[] = { 1449 static const struct GNUNET_SERVER_MessageHandler server_handlers[] = {
1448 {handle_client_accept, NULL, GNUNET_MESSAGE_TYPE_SET_ACCEPT, 1450 {handle_client_accept, NULL, GNUNET_MESSAGE_TYPE_SET_ACCEPT,
1449 sizeof (struct GNUNET_SET_AcceptRejectMessage)}, 1451 sizeof (struct GNUNET_SET_AcceptMessage)},
1450 {handle_client_iter_ack, NULL, GNUNET_MESSAGE_TYPE_SET_ITER_ACK, 0}, 1452 {handle_client_iter_ack, NULL, GNUNET_MESSAGE_TYPE_SET_ITER_ACK, 0},
1451 {handle_client_add_remove, NULL, GNUNET_MESSAGE_TYPE_SET_ADD, 0}, 1453 {handle_client_add_remove, NULL, GNUNET_MESSAGE_TYPE_SET_ADD, 0},
1452 {handle_client_create_set, NULL, GNUNET_MESSAGE_TYPE_SET_CREATE, 1454 {handle_client_create_set, NULL, GNUNET_MESSAGE_TYPE_SET_CREATE,
@@ -1457,7 +1459,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1457 {handle_client_listen, NULL, GNUNET_MESSAGE_TYPE_SET_LISTEN, 1459 {handle_client_listen, NULL, GNUNET_MESSAGE_TYPE_SET_LISTEN,
1458 sizeof (struct GNUNET_SET_ListenMessage)}, 1460 sizeof (struct GNUNET_SET_ListenMessage)},
1459 {handle_client_reject, NULL, GNUNET_MESSAGE_TYPE_SET_REJECT, 1461 {handle_client_reject, NULL, GNUNET_MESSAGE_TYPE_SET_REJECT,
1460 sizeof (struct GNUNET_SET_AcceptRejectMessage)}, 1462 sizeof (struct GNUNET_SET_RejectMessage)},
1461 {handle_client_add_remove, NULL, GNUNET_MESSAGE_TYPE_SET_REMOVE, 0}, 1463 {handle_client_add_remove, NULL, GNUNET_MESSAGE_TYPE_SET_REMOVE, 0},
1462 {handle_client_cancel, NULL, GNUNET_MESSAGE_TYPE_SET_CANCEL, 1464 {handle_client_cancel, NULL, GNUNET_MESSAGE_TYPE_SET_CANCEL,
1463 sizeof (struct GNUNET_SET_CancelMessage)}, 1465 sizeof (struct GNUNET_SET_CancelMessage)},