aboutsummaryrefslogtreecommitdiff
path: root/src/set/gnunet-service-set.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/gnunet-service-set.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/gnunet-service-set.c')
-rw-r--r--src/set/gnunet-service-set.c284
1 files changed, 124 insertions, 160 deletions
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index 454ad9784..8f1506c6a 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -24,6 +24,8 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "gnunet-service-set.h" 26#include "gnunet-service-set.h"
27#include "gnunet-service-set_union.h"
28#include "gnunet-service-set_intersection.h"
27#include "gnunet-service-set_protocol.h" 29#include "gnunet-service-set_protocol.h"
28#include "gnunet_statistics_service.h" 30#include "gnunet_statistics_service.h"
29 31
@@ -476,6 +478,7 @@ _GSS_operation_destroy (struct Operation *op,
476 op->channel = NULL; 478 op->channel = NULL;
477 GNUNET_CADET_channel_destroy (channel); 479 GNUNET_CADET_channel_destroy (channel);
478 } 480 }
481
479 if (GNUNET_YES == gc) 482 if (GNUNET_YES == gc)
480 collect_generation_garbage (set); 483 collect_generation_garbage (set);
481 /* We rely on the channel end handler to free 'op'. When 'op->channel' was NULL, 484 /* We rely on the channel end handler to free 'op'. When 'op->channel' was NULL,
@@ -682,7 +685,7 @@ client_disconnect_cb (void *cls,
682 { 685 {
683 struct Operation *curr = op; 686 struct Operation *curr = op;
684 op = op->next; 687 op = op->next;
685 if ( (GNUNET_YES == curr->is_incoming) && 688 if ( (GNUNET_YES == curr->is_incoming) &&
686 (curr->listener == listener) ) 689 (curr->listener == listener) )
687 incoming_destroy (curr); 690 incoming_destroy (curr);
688 } 691 }
@@ -733,6 +736,38 @@ incoming_suggest (struct Operation *incoming,
733 736
734 737
735/** 738/**
739 * Check a request for a set operation from another peer.
740 *
741 * @param cls the operation state
742 * @param msg the received message
743 * @return #GNUNET_OK if the channel should be kept alive,
744 * #GNUNET_SYSERR to destroy the channel
745 */
746static int
747check_incoming_msg (void *cls,
748 const struct OperationRequestMessage *msg)
749{
750 struct Operation *op = cls;
751 const struct GNUNET_MessageHeader *nested_context;
752
753 /* double operation request */
754 if (NULL != op->spec)
755 {
756 GNUNET_break_op (0);
757 return GNUNET_SYSERR;
758 }
759 nested_context = GNUNET_MQ_extract_nested_mh (msg);
760 if ( (NULL != nested_context) &&
761 (ntohs (nested_context->size) > GNUNET_SET_CONTEXT_MESSAGE_MAX_SIZE) )
762 {
763 GNUNET_break_op (0);
764 return GNUNET_SYSERR;
765 }
766 return GNUNET_OK;
767}
768
769
770/**
736 * Handle a request for a set operation from another peer. Checks if we 771 * Handle a request for a set operation from another peer. Checks if we
737 * have a listener waiting for such a request (and in that case initiates 772 * have a listener waiting for such a request (and in that case initiates
738 * asking the listener about accepting the connection). If no listener 773 * asking the listener about accepting the connection). If no listener
@@ -744,42 +779,23 @@ incoming_suggest (struct Operation *incoming,
744 * our virtual table and subsequent msgs would be routed differently (as 779 * our virtual table and subsequent msgs would be routed differently (as
745 * we then know what type of operation this is). 780 * we then know what type of operation this is).
746 * 781 *
747 * @param op the operation state 782 * @param cls the operation state
748 * @param mh the received message 783 * @param msg the received message
749 * @return #GNUNET_OK if the channel should be kept alive, 784 * @return #GNUNET_OK if the channel should be kept alive,
750 * #GNUNET_SYSERR to destroy the channel 785 * #GNUNET_SYSERR to destroy the channel
751 */ 786 */
752static int 787static void
753handle_incoming_msg (struct Operation *op, 788handle_incoming_msg (void *cls,
754 const struct GNUNET_MessageHeader *mh) 789 const struct OperationRequestMessage *msg)
755{ 790{
756 const struct OperationRequestMessage *msg; 791 struct Operation *op = cls;
757 struct Listener *listener = op->listener; 792 struct Listener *listener = op->listener;
758 struct OperationSpecification *spec; 793 struct OperationSpecification *spec;
759 const struct GNUNET_MessageHeader *nested_context; 794 const struct GNUNET_MessageHeader *nested_context;
760 795
761 msg = (const struct OperationRequestMessage *) mh;
762 GNUNET_assert (GNUNET_YES == op->is_incoming); 796 GNUNET_assert (GNUNET_YES == op->is_incoming);
763 if (GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST != ntohs (mh->type))
764 {
765 GNUNET_break_op (0);
766 return GNUNET_SYSERR;
767 }
768 /* double operation request */
769 if (NULL != op->spec)
770 {
771 GNUNET_break_op (0);
772 return GNUNET_SYSERR;
773 }
774 spec = GNUNET_new (struct OperationSpecification); 797 spec = GNUNET_new (struct OperationSpecification);
775 nested_context = GNUNET_MQ_extract_nested_mh (msg); 798 nested_context = GNUNET_MQ_extract_nested_mh (msg);
776 if ( (NULL != nested_context) &&
777 (ntohs (nested_context->size) > GNUNET_SET_CONTEXT_MESSAGE_MAX_SIZE) )
778 {
779 GNUNET_break_op (0);
780 GNUNET_free (spec);
781 return GNUNET_SYSERR;
782 }
783 /* Make a copy of the nested_context (application-specific context 799 /* Make a copy of the nested_context (application-specific context
784 information that is opaque to set) so we can pass it to the 800 information that is opaque to set) so we can pass it to the
785 listener later on */ 801 listener later on */
@@ -792,7 +808,6 @@ handle_incoming_msg (struct Operation *op,
792 spec->peer = op->peer; 808 spec->peer = op->peer;
793 spec->remote_element_count = ntohl (msg->element_count); 809 spec->remote_element_count = ntohl (msg->element_count);
794 op->spec = spec; 810 op->spec = spec;
795
796 listener = op->listener; 811 listener = op->listener;
797 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 812 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
798 "Received P2P operation request (op %u, port %s) for active listener\n", 813 "Received P2P operation request (op %u, port %s) for active listener\n",
@@ -800,7 +815,6 @@ handle_incoming_msg (struct Operation *op,
800 GNUNET_h2s (&listener->app_id)); 815 GNUNET_h2s (&listener->app_id));
801 incoming_suggest (op, 816 incoming_suggest (op,
802 listener); 817 listener);
803 return GNUNET_OK;
804} 818}
805 819
806 820
@@ -1103,9 +1117,11 @@ handle_client_create_set (void *cls,
1103 { 1117 {
1104 case GNUNET_SET_OPERATION_INTERSECTION: 1118 case GNUNET_SET_OPERATION_INTERSECTION:
1105 set->vt = _GSS_intersection_vt (); 1119 set->vt = _GSS_intersection_vt ();
1120 set->type = OT_INTERSECTION;
1106 break; 1121 break;
1107 case GNUNET_SET_OPERATION_UNION: 1122 case GNUNET_SET_OPERATION_UNION:
1108 set->vt = _GSS_union_vt (); 1123 set->vt = _GSS_union_vt ();
1124 set->type = OT_UNION;
1109 break; 1125 break;
1110 default: 1126 default:
1111 GNUNET_free (set); 1127 GNUNET_free (set);
@@ -1196,7 +1212,6 @@ channel_new_cb (void *cls,
1196 const struct GNUNET_PeerIdentity *source) 1212 const struct GNUNET_PeerIdentity *source)
1197{ 1213{
1198 static const struct SetVT incoming_vt = { 1214 static const struct SetVT incoming_vt = {
1199 .msg_handler = &handle_incoming_msg,
1200 .peer_disconnect = &handle_incoming_disconnect 1215 .peer_disconnect = &handle_incoming_disconnect
1201 }; 1216 };
1202 struct Listener *listener = cls; 1217 struct Listener *listener = cls;
@@ -1290,60 +1305,6 @@ channel_window_cb (void *cls,
1290 /* FIXME: not implemented, we could do flow control here... */ 1305 /* FIXME: not implemented, we could do flow control here... */
1291} 1306}
1292 1307
1293/**
1294 * FIXME: hack-job. Migrate to proper handler array use!
1295 *
1296 * @param cls local state associated with the channel.
1297 * @param message The actual message.
1298 */
1299static int
1300check_p2p_message (void *cls,
1301 const struct GNUNET_MessageHeader *message)
1302{
1303 return GNUNET_OK;
1304}
1305
1306
1307/**
1308 * FIXME: hack-job. Migrate to proper handler array use!
1309 *
1310 * Functions with this signature are called whenever a message is
1311 * received via a cadet channel.
1312 *
1313 * The msg_handler is a virtual table set in initially either when a peer
1314 * creates a new channel with us, or once we create a new channel
1315 * ourselves (evaluate).
1316 *
1317 * Once we know the exact type of operation (union/intersection), the vt is
1318 * replaced with an operation specific instance (_GSS_[op]_vt).
1319 *
1320 * @param cls local state associated with the channel.
1321 * @param message The actual message.
1322 */
1323static void
1324handle_p2p_message (void *cls,
1325 const struct GNUNET_MessageHeader *message)
1326{
1327 struct Operation *op = cls;
1328 int ret;
1329
1330 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1331 "Dispatching cadet message (type: %u)\n",
1332 ntohs (message->type));
1333 /* do this before the handler, as the handler might kill the channel */
1334 GNUNET_CADET_receive_done (op->channel);
1335 if (NULL != op->vt)
1336 ret = op->vt->msg_handler (op,
1337 message);
1338 else
1339 ret = GNUNET_SYSERR;
1340 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1341 "Handled cadet message (type: %u)\n",
1342 ntohs (message->type));
1343 if (GNUNET_OK != ret)
1344 GNUNET_CADET_channel_destroy (op->channel);
1345}
1346
1347 1308
1348/** 1309/**
1349 * Called when a client wants to create a new listener. 1310 * Called when a client wants to create a new listener.
@@ -1357,66 +1318,66 @@ handle_client_listen (void *cls,
1357{ 1318{
1358 struct GNUNET_SERVICE_Client *client = cls; 1319 struct GNUNET_SERVICE_Client *client = cls;
1359 struct GNUNET_MQ_MessageHandler cadet_handlers[] = { 1320 struct GNUNET_MQ_MessageHandler cadet_handlers[] = {
1360 GNUNET_MQ_hd_var_size (p2p_message, 1321 GNUNET_MQ_hd_var_size (incoming_msg,
1361 GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST, 1322 GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST,
1362 struct GNUNET_MessageHeader, 1323 struct OperationRequestMessage,
1363 NULL), 1324 NULL),
1364 GNUNET_MQ_hd_var_size (p2p_message, 1325 GNUNET_MQ_hd_var_size (union_p2p_ibf,
1365 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF, 1326 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF,
1366 struct GNUNET_MessageHeader, 1327 struct IBFMessage,
1367 NULL), 1328 NULL),
1368 GNUNET_MQ_hd_var_size (p2p_message, 1329 GNUNET_MQ_hd_var_size (union_p2p_elements,
1369 GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS, 1330 GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS,
1370 struct GNUNET_MessageHeader, 1331 struct GNUNET_SET_ElementMessage,
1371 NULL), 1332 NULL),
1372 GNUNET_MQ_hd_var_size (p2p_message, 1333 GNUNET_MQ_hd_var_size (union_p2p_offer,
1373 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_OFFER, 1334 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_OFFER,
1374 struct GNUNET_MessageHeader, 1335 struct GNUNET_MessageHeader,
1375 NULL), 1336 NULL),
1376 GNUNET_MQ_hd_var_size (p2p_message, 1337 GNUNET_MQ_hd_var_size (union_p2p_inquiry,
1377 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_INQUIRY, 1338 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_INQUIRY,
1378 struct GNUNET_MessageHeader, 1339 struct InquiryMessage,
1379 NULL), 1340 NULL),
1380 GNUNET_MQ_hd_var_size (p2p_message, 1341 GNUNET_MQ_hd_var_size (union_p2p_demand,
1381 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DEMAND, 1342 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DEMAND,
1382 struct GNUNET_MessageHeader, 1343 struct GNUNET_MessageHeader,
1383 NULL), 1344 NULL),
1384 GNUNET_MQ_hd_var_size (p2p_message, 1345 GNUNET_MQ_hd_fixed_size (union_p2p_done,
1385 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DONE, 1346 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DONE,
1386 struct GNUNET_MessageHeader, 1347 struct GNUNET_MessageHeader,
1387 NULL), 1348 NULL),
1388 GNUNET_MQ_hd_var_size (p2p_message, 1349 GNUNET_MQ_hd_fixed_size (union_p2p_full_done,
1389 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_DONE, 1350 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_DONE,
1390 struct GNUNET_MessageHeader, 1351 struct GNUNET_MessageHeader,
1391 NULL), 1352 NULL),
1392 GNUNET_MQ_hd_var_size (p2p_message, 1353 GNUNET_MQ_hd_fixed_size (union_p2p_request_full,
1393 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_REQUEST_FULL, 1354 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_REQUEST_FULL,
1394 struct GNUNET_MessageHeader, 1355 struct GNUNET_MessageHeader,
1395 NULL), 1356 NULL),
1396 GNUNET_MQ_hd_var_size (p2p_message, 1357 GNUNET_MQ_hd_var_size (union_p2p_strata_estimator,
1397 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE, 1358 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE,
1398 struct GNUNET_MessageHeader, 1359 struct StrataEstimatorMessage,
1399 NULL), 1360 NULL),
1400 GNUNET_MQ_hd_var_size (p2p_message, 1361 GNUNET_MQ_hd_var_size (union_p2p_strata_estimator,
1401 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SEC, 1362 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SEC,
1402 struct GNUNET_MessageHeader, 1363 struct StrataEstimatorMessage,
1403 NULL), 1364 NULL),
1404 GNUNET_MQ_hd_var_size (p2p_message, 1365 GNUNET_MQ_hd_var_size (union_p2p_full_element,
1405 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_ELEMENT, 1366 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_ELEMENT,
1406 struct GNUNET_MessageHeader, 1367 struct GNUNET_SET_ElementMessage,
1407 NULL), 1368 NULL),
1408 GNUNET_MQ_hd_var_size (p2p_message, 1369 GNUNET_MQ_hd_fixed_size (intersection_p2p_element_info,
1409 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_ELEMENT_INFO, 1370 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_ELEMENT_INFO,
1410 struct GNUNET_MessageHeader, 1371 struct IntersectionElementInfoMessage,
1411 NULL), 1372 NULL),
1412 GNUNET_MQ_hd_var_size (p2p_message, 1373 GNUNET_MQ_hd_var_size (intersection_p2p_bf,
1413 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF, 1374 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF,
1414 struct GNUNET_MessageHeader, 1375 struct BFMessage,
1415 NULL),
1416 GNUNET_MQ_hd_var_size (p2p_message,
1417 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE,
1418 struct GNUNET_MessageHeader,
1419 NULL), 1376 NULL),
1377 GNUNET_MQ_hd_fixed_size (intersection_p2p_done,
1378 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE,
1379 struct IntersectionDoneMessage,
1380 NULL),
1420 GNUNET_MQ_handler_end () 1381 GNUNET_MQ_handler_end ()
1421 }; 1382 };
1422 struct Listener *listener; 1383 struct Listener *listener;
@@ -1623,66 +1584,66 @@ handle_client_evaluate (void *cls,
1623 struct GNUNET_SERVICE_Client *client = cls; 1584 struct GNUNET_SERVICE_Client *client = cls;
1624 struct Operation *op = GNUNET_new (struct Operation); 1585 struct Operation *op = GNUNET_new (struct Operation);
1625 const struct GNUNET_MQ_MessageHandler cadet_handlers[] = { 1586 const struct GNUNET_MQ_MessageHandler cadet_handlers[] = {
1626 GNUNET_MQ_hd_var_size (p2p_message, 1587 GNUNET_MQ_hd_var_size (incoming_msg,
1627 GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST, 1588 GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST,
1628 struct GNUNET_MessageHeader, 1589 struct OperationRequestMessage,
1629 op), 1590 op),
1630 GNUNET_MQ_hd_var_size (p2p_message, 1591 GNUNET_MQ_hd_var_size (union_p2p_ibf,
1631 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF, 1592 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF,
1632 struct GNUNET_MessageHeader, 1593 struct IBFMessage,
1633 op), 1594 op),
1634 GNUNET_MQ_hd_var_size (p2p_message, 1595 GNUNET_MQ_hd_var_size (union_p2p_elements,
1635 GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS, 1596 GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS,
1636 struct GNUNET_MessageHeader, 1597 struct GNUNET_SET_ElementMessage,
1637 op), 1598 op),
1638 GNUNET_MQ_hd_var_size (p2p_message, 1599 GNUNET_MQ_hd_var_size (union_p2p_offer,
1639 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_OFFER, 1600 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_OFFER,
1640 struct GNUNET_MessageHeader, 1601 struct GNUNET_MessageHeader,
1641 op), 1602 op),
1642 GNUNET_MQ_hd_var_size (p2p_message, 1603 GNUNET_MQ_hd_var_size (union_p2p_inquiry,
1643 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_INQUIRY, 1604 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_INQUIRY,
1644 struct GNUNET_MessageHeader, 1605 struct InquiryMessage,
1645 op), 1606 op),
1646 GNUNET_MQ_hd_var_size (p2p_message, 1607 GNUNET_MQ_hd_var_size (union_p2p_demand,
1647 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DEMAND, 1608 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DEMAND,
1648 struct GNUNET_MessageHeader, 1609 struct GNUNET_MessageHeader,
1649 op), 1610 op),
1650 GNUNET_MQ_hd_var_size (p2p_message, 1611 GNUNET_MQ_hd_fixed_size (union_p2p_done,
1651 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DONE, 1612 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DONE,
1652 struct GNUNET_MessageHeader, 1613 struct GNUNET_MessageHeader,
1653 op), 1614 op),
1654 GNUNET_MQ_hd_var_size (p2p_message, 1615 GNUNET_MQ_hd_fixed_size (union_p2p_full_done,
1616 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_DONE,
1617 struct GNUNET_MessageHeader,
1618 op),
1619 GNUNET_MQ_hd_fixed_size (union_p2p_request_full,
1620 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_REQUEST_FULL,
1621 struct GNUNET_MessageHeader,
1622 op),
1623 GNUNET_MQ_hd_var_size (union_p2p_strata_estimator,
1655 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE, 1624 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE,
1656 struct GNUNET_MessageHeader, 1625 struct StrataEstimatorMessage,
1657 op), 1626 op),
1658 GNUNET_MQ_hd_var_size (p2p_message, 1627 GNUNET_MQ_hd_var_size (union_p2p_strata_estimator,
1659 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SEC, 1628 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SEC,
1660 struct GNUNET_MessageHeader, 1629 struct StrataEstimatorMessage,
1661 op),
1662 GNUNET_MQ_hd_var_size (p2p_message,
1663 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_DONE,
1664 struct GNUNET_MessageHeader,
1665 op),
1666 GNUNET_MQ_hd_var_size (p2p_message,
1667 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_REQUEST_FULL,
1668 struct GNUNET_MessageHeader,
1669 op), 1630 op),
1670 GNUNET_MQ_hd_var_size (p2p_message, 1631 GNUNET_MQ_hd_var_size (union_p2p_full_element,
1671 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_ELEMENT, 1632 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_ELEMENT,
1672 struct GNUNET_MessageHeader, 1633 struct GNUNET_SET_ElementMessage,
1673 op),
1674 GNUNET_MQ_hd_var_size (p2p_message,
1675 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_ELEMENT_INFO,
1676 struct GNUNET_MessageHeader,
1677 op), 1634 op),
1678 GNUNET_MQ_hd_var_size (p2p_message, 1635 GNUNET_MQ_hd_fixed_size (intersection_p2p_element_info,
1636 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_ELEMENT_INFO,
1637 struct IntersectionElementInfoMessage,
1638 op),
1639 GNUNET_MQ_hd_var_size (intersection_p2p_bf,
1679 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF, 1640 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF,
1680 struct GNUNET_MessageHeader, 1641 struct BFMessage,
1681 op),
1682 GNUNET_MQ_hd_var_size (p2p_message,
1683 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE,
1684 struct GNUNET_MessageHeader,
1685 op), 1642 op),
1643 GNUNET_MQ_hd_fixed_size (intersection_p2p_done,
1644 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE,
1645 struct IntersectionDoneMessage,
1646 op),
1686 GNUNET_MQ_handler_end () 1647 GNUNET_MQ_handler_end ()
1687 }; 1648 };
1688 struct Set *set; 1649 struct Set *set;
@@ -1717,7 +1678,7 @@ handle_client_evaluate (void *cls,
1717 // mutations won't interfer with the running operation. 1678 // mutations won't interfer with the running operation.
1718 op->generation_created = set->current_generation; 1679 op->generation_created = set->current_generation;
1719 advance_generation (set); 1680 advance_generation (set);
1720 1681 op->type = set->type;
1721 op->vt = set->vt; 1682 op->vt = set->vt;
1722 GNUNET_CONTAINER_DLL_insert (set->ops_head, 1683 GNUNET_CONTAINER_DLL_insert (set->ops_head,
1723 set->ops_tail, 1684 set->ops_tail,
@@ -1886,9 +1847,11 @@ handle_client_copy_lazy_connect (void *cls,
1886 { 1847 {
1887 case GNUNET_SET_OPERATION_INTERSECTION: 1848 case GNUNET_SET_OPERATION_INTERSECTION:
1888 set->vt = _GSS_intersection_vt (); 1849 set->vt = _GSS_intersection_vt ();
1850 set->type = OT_INTERSECTION;
1889 break; 1851 break;
1890 case GNUNET_SET_OPERATION_UNION: 1852 case GNUNET_SET_OPERATION_UNION:
1891 set->vt = _GSS_union_vt (); 1853 set->vt = _GSS_union_vt ();
1854 set->type = OT_UNION;
1892 break; 1855 break;
1893 default: 1856 default:
1894 GNUNET_assert (0); 1857 GNUNET_assert (0);
@@ -2057,6 +2020,7 @@ handle_client_accept (void *cls,
2057 advance_generation (set); 2020 advance_generation (set);
2058 2021
2059 op->vt = set->vt; 2022 op->vt = set->vt;
2023 op->type = set->type;
2060 op->vt->accept (op); 2024 op->vt->accept (op);
2061 GNUNET_SERVICE_client_continue (client); 2025 GNUNET_SERVICE_client_continue (client);
2062} 2026}