diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-08-14 15:25:12 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-08-14 15:25:12 +0000 |
commit | 5f925941b0954eee3c93bd6fe72eeb092106cea2 (patch) | |
tree | 192863362e36389e8bc4d33509a2526df5409d62 /src/set | |
parent | 44f731908bf2c9551b913292f29fed12c425846f (diff) | |
download | gnunet-5f925941b0954eee3c93bd6fe72eeb092106cea2.tar.gz gnunet-5f925941b0954eee3c93bd6fe72eeb092106cea2.zip |
migrating set to new CADET port API - tests now fail due to CADET issues
Diffstat (limited to 'src/set')
-rw-r--r-- | src/set/gnunet-service-set.c | 283 | ||||
-rw-r--r-- | src/set/gnunet-service-set.h | 8 | ||||
-rw-r--r-- | src/set/gnunet-service-set_intersection.c | 1 | ||||
-rw-r--r-- | src/set/gnunet-service-set_protocol.h | 2 | ||||
-rw-r--r-- | src/set/gnunet-service-set_union.c | 1 | ||||
-rw-r--r-- | src/set/test_set.conf | 2 | ||||
-rw-r--r-- | src/set/test_set_api.c | 2 |
7 files changed, 144 insertions, 155 deletions
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c index 16f330a4d..e4e2535af 100644 --- a/src/set/gnunet-service-set.c +++ b/src/set/gnunet-service-set.c | |||
@@ -67,6 +67,11 @@ struct Listener | |||
67 | struct GNUNET_HashCode app_id; | 67 | struct GNUNET_HashCode app_id; |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * The port we are listening on with CADET. | ||
71 | */ | ||
72 | struct GNUNET_CADET_Port *open_port; | ||
73 | |||
74 | /** | ||
70 | * The type of the operation. | 75 | * The type of the operation. |
71 | */ | 76 | */ |
72 | enum GNUNET_SET_OperationType operation; | 77 | enum GNUNET_SET_OperationType operation; |
@@ -229,6 +234,7 @@ listener_destroy (struct Listener *listener) | |||
229 | GNUNET_MQ_destroy (listener->client_mq); | 234 | GNUNET_MQ_destroy (listener->client_mq); |
230 | listener->client_mq = NULL; | 235 | listener->client_mq = NULL; |
231 | } | 236 | } |
237 | GNUNET_CADET_close_port (listener->open_port); | ||
232 | GNUNET_CONTAINER_DLL_remove (listeners_head, | 238 | GNUNET_CONTAINER_DLL_remove (listeners_head, |
233 | listeners_tail, | 239 | listeners_tail, |
234 | listener); | 240 | listener); |
@@ -320,7 +326,8 @@ collect_generation_garbage (struct Set *set) | |||
320 | &gc); | 326 | &gc); |
321 | } | 327 | } |
322 | 328 | ||
323 | int | 329 | |
330 | static int | ||
324 | is_excluded_generation (unsigned int generation, | 331 | is_excluded_generation (unsigned int generation, |
325 | struct GenerationRange *excluded, | 332 | struct GenerationRange *excluded, |
326 | unsigned int excluded_size) | 333 | unsigned int excluded_size) |
@@ -337,7 +344,7 @@ is_excluded_generation (unsigned int generation, | |||
337 | } | 344 | } |
338 | 345 | ||
339 | 346 | ||
340 | int | 347 | static int |
341 | is_element_of_generation (struct ElementEntry *ee, | 348 | is_element_of_generation (struct ElementEntry *ee, |
342 | unsigned int query_generation, | 349 | unsigned int query_generation, |
343 | struct GenerationRange *excluded, | 350 | struct GenerationRange *excluded, |
@@ -611,8 +618,8 @@ static void | |||
611 | handle_client_disconnect (void *cls, | 618 | handle_client_disconnect (void *cls, |
612 | struct GNUNET_SERVER_Client *client) | 619 | struct GNUNET_SERVER_Client *client) |
613 | { | 620 | { |
614 | struct Set *set; | ||
615 | struct Listener *listener; | 621 | struct Listener *listener; |
622 | struct Set *set; | ||
616 | 623 | ||
617 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 624 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
618 | "client disconnected, cleaning up\n"); | 625 | "client disconnected, cleaning up\n"); |
@@ -675,29 +682,6 @@ incoming_destroy (struct Operation *incoming) | |||
675 | 682 | ||
676 | 683 | ||
677 | /** | 684 | /** |
678 | * Find a listener that is interested in the given operation type | ||
679 | * and application id. | ||
680 | * | ||
681 | * @param op operation type to look for | ||
682 | * @param app_id application id to look for | ||
683 | * @return a matching listener, or NULL if no listener matches the | ||
684 | * given operation and application id | ||
685 | */ | ||
686 | static struct Listener * | ||
687 | listener_get_by_target (enum GNUNET_SET_OperationType op, | ||
688 | const struct GNUNET_HashCode *app_id) | ||
689 | { | ||
690 | struct Listener *listener; | ||
691 | |||
692 | for (listener = listeners_head; NULL != listener; listener = listener->next) | ||
693 | if ( (listener->operation == op) && | ||
694 | (0 == GNUNET_CRYPTO_hash_cmp (app_id, &listener->app_id)) ) | ||
695 | return listener; | ||
696 | return NULL; | ||
697 | } | ||
698 | |||
699 | |||
700 | /** | ||
701 | * Suggest the given request to the listener. The listening client can | 685 | * Suggest the given request to the listener. The listening client can |
702 | * then accept or reject the remote request. | 686 | * then accept or reject the remote request. |
703 | * | 687 | * |
@@ -729,7 +713,8 @@ incoming_suggest (struct Operation *incoming, | |||
729 | incoming->suggest_id); | 713 | incoming->suggest_id); |
730 | cmsg->accept_id = htonl (incoming->suggest_id); | 714 | cmsg->accept_id = htonl (incoming->suggest_id); |
731 | cmsg->peer_id = incoming->spec->peer; | 715 | cmsg->peer_id = incoming->spec->peer; |
732 | GNUNET_MQ_send (listener->client_mq, mqm); | 716 | GNUNET_MQ_send (listener->client_mq, |
717 | mqm); | ||
733 | } | 718 | } |
734 | 719 | ||
735 | 720 | ||
@@ -755,7 +740,7 @@ handle_incoming_msg (struct Operation *op, | |||
755 | const struct GNUNET_MessageHeader *mh) | 740 | const struct GNUNET_MessageHeader *mh) |
756 | { | 741 | { |
757 | const struct OperationRequestMessage *msg; | 742 | const struct OperationRequestMessage *msg; |
758 | struct Listener *listener; | 743 | struct Listener *listener = op->listener; |
759 | struct OperationSpecification *spec; | 744 | struct OperationSpecification *spec; |
760 | const struct GNUNET_MessageHeader *nested_context; | 745 | const struct GNUNET_MessageHeader *nested_context; |
761 | 746 | ||
@@ -787,29 +772,20 @@ handle_incoming_msg (struct Operation *op, | |||
787 | if (NULL != nested_context) | 772 | if (NULL != nested_context) |
788 | spec->context_msg = GNUNET_copy_message (nested_context); | 773 | spec->context_msg = GNUNET_copy_message (nested_context); |
789 | spec->operation = ntohl (msg->operation); | 774 | spec->operation = ntohl (msg->operation); |
790 | spec->app_id = msg->app_id; | 775 | spec->app_id = listener->app_id; |
791 | spec->salt = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, | 776 | spec->salt = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, |
792 | UINT32_MAX); | 777 | UINT32_MAX); |
793 | spec->peer = op->peer; | 778 | spec->peer = op->peer; |
794 | spec->remote_element_count = ntohl (msg->element_count); | 779 | spec->remote_element_count = ntohl (msg->element_count); |
795 | op->spec = spec; | 780 | op->spec = spec; |
796 | 781 | ||
797 | listener = listener_get_by_target (ntohl (msg->operation), | 782 | listener = op->listener; |
798 | &msg->app_id); | ||
799 | if (NULL == listener) | ||
800 | { | ||
801 | GNUNET_break (NULL != op->timeout_task); | ||
802 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
803 | "No matching listener for incoming request (op %u, app %s), waiting with timeout\n", | ||
804 | ntohl (msg->operation), | ||
805 | GNUNET_h2s (&msg->app_id)); | ||
806 | return GNUNET_OK; | ||
807 | } | ||
808 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 783 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
809 | "Received P2P operation request (op %u, app %s) for active listener\n", | 784 | "Received P2P operation request (op %u, port %s) for active listener\n", |
810 | ntohl (msg->operation), | 785 | ntohl (msg->operation), |
811 | GNUNET_h2s (&msg->app_id)); | 786 | GNUNET_h2s (&listener->app_id)); |
812 | incoming_suggest (op, listener); | 787 | incoming_suggest (op, |
788 | listener); | ||
813 | return GNUNET_OK; | 789 | return GNUNET_OK; |
814 | } | 790 | } |
815 | 791 | ||
@@ -1134,6 +1110,100 @@ handle_client_create_set (void *cls, | |||
1134 | 1110 | ||
1135 | 1111 | ||
1136 | /** | 1112 | /** |
1113 | * Timeout happens iff: | ||
1114 | * - we suggested an operation to our listener, | ||
1115 | * but did not receive a response in time | ||
1116 | * - we got the channel from a peer but no #GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST | ||
1117 | * | ||
1118 | * @param cls channel context | ||
1119 | * @param tc context information (why was this task triggered now) | ||
1120 | */ | ||
1121 | static void | ||
1122 | incoming_timeout_cb (void *cls) | ||
1123 | { | ||
1124 | struct Operation *incoming = cls; | ||
1125 | |||
1126 | incoming->timeout_task = NULL; | ||
1127 | GNUNET_assert (GNUNET_YES == incoming->is_incoming); | ||
1128 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1129 | "Remote peer's incoming request timed out\n"); | ||
1130 | incoming_destroy (incoming); | ||
1131 | } | ||
1132 | |||
1133 | |||
1134 | /** | ||
1135 | * Terminates an incoming operation in case we have not yet received an | ||
1136 | * operation request. Called by the channel destruction handler. | ||
1137 | * | ||
1138 | * @param op the channel context | ||
1139 | */ | ||
1140 | static void | ||
1141 | handle_incoming_disconnect (struct Operation *op) | ||
1142 | { | ||
1143 | GNUNET_assert (GNUNET_YES == op->is_incoming); | ||
1144 | /* channel is already dead, incoming_destroy must not | ||
1145 | * destroy it ... */ | ||
1146 | op->channel = NULL; | ||
1147 | incoming_destroy (op); | ||
1148 | op->vt = NULL; | ||
1149 | } | ||
1150 | |||
1151 | |||
1152 | /** | ||
1153 | * Method called whenever another peer has added us to a channel the | ||
1154 | * other peer initiated. Only called (once) upon reception of data | ||
1155 | * from a channel we listen on. | ||
1156 | * | ||
1157 | * The channel context represents the operation itself and gets added | ||
1158 | * to a DLL, from where it gets looked up when our local listener | ||
1159 | * client responds to a proposed/suggested operation or connects and | ||
1160 | * associates with this operation. | ||
1161 | * | ||
1162 | * @param cls closure | ||
1163 | * @param channel new handle to the channel | ||
1164 | * @param initiator peer that started the channel | ||
1165 | * @param port Port this channel is for. | ||
1166 | * @param options Unused. | ||
1167 | * @return initial channel context for the channel | ||
1168 | * returns NULL on error | ||
1169 | */ | ||
1170 | static void * | ||
1171 | channel_new_cb (void *cls, | ||
1172 | struct GNUNET_CADET_Channel *channel, | ||
1173 | const struct GNUNET_PeerIdentity *initiator, | ||
1174 | const struct GNUNET_HashCode *port, | ||
1175 | enum GNUNET_CADET_ChannelOption options) | ||
1176 | { | ||
1177 | static const struct SetVT incoming_vt = { | ||
1178 | .msg_handler = &handle_incoming_msg, | ||
1179 | .peer_disconnect = &handle_incoming_disconnect | ||
1180 | }; | ||
1181 | struct Listener *listener = cls; | ||
1182 | struct Operation *incoming; | ||
1183 | |||
1184 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1185 | "New incoming channel\n"); | ||
1186 | incoming = GNUNET_new (struct Operation); | ||
1187 | incoming->listener = listener; | ||
1188 | incoming->is_incoming = GNUNET_YES; | ||
1189 | incoming->peer = *initiator; | ||
1190 | incoming->channel = channel; | ||
1191 | incoming->mq = GNUNET_CADET_mq_create (incoming->channel); | ||
1192 | incoming->vt = &incoming_vt; | ||
1193 | incoming->timeout_task | ||
1194 | = GNUNET_SCHEDULER_add_delayed (INCOMING_CHANNEL_TIMEOUT, | ||
1195 | &incoming_timeout_cb, | ||
1196 | incoming); | ||
1197 | GNUNET_CONTAINER_DLL_insert_tail (incoming_head, | ||
1198 | incoming_tail, | ||
1199 | incoming); | ||
1200 | // incoming_suggest (incoming, | ||
1201 | // listener); | ||
1202 | return incoming; | ||
1203 | } | ||
1204 | |||
1205 | |||
1206 | /** | ||
1137 | * Called when a client wants to create a new listener. | 1207 | * Called when a client wants to create a new listener. |
1138 | * | 1208 | * |
1139 | * @param cls unused | 1209 | * @param cls unused |
@@ -1165,8 +1235,12 @@ handle_client_listen (void *cls, | |||
1165 | GNUNET_CONTAINER_DLL_insert_tail (listeners_head, | 1235 | GNUNET_CONTAINER_DLL_insert_tail (listeners_head, |
1166 | listeners_tail, | 1236 | listeners_tail, |
1167 | listener); | 1237 | listener); |
1238 | listener->open_port = GNUNET_CADET_open_port (cadet, | ||
1239 | &msg->app_id, | ||
1240 | &channel_new_cb, | ||
1241 | listener); | ||
1168 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1242 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1169 | "New listener created (op %u, app %s)\n", | 1243 | "New listener created (op %u, port %s)\n", |
1170 | listener->operation, | 1244 | listener->operation, |
1171 | GNUNET_h2s (&listener->app_id)); | 1245 | GNUNET_h2s (&listener->app_id)); |
1172 | 1246 | ||
@@ -1187,7 +1261,8 @@ handle_client_listen (void *cls, | |||
1187 | incoming_suggest (op, | 1261 | incoming_suggest (op, |
1188 | listener); | 1262 | listener); |
1189 | } | 1263 | } |
1190 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1264 | GNUNET_SERVER_receive_done (client, |
1265 | GNUNET_OK); | ||
1191 | } | 1266 | } |
1192 | 1267 | ||
1193 | 1268 | ||
@@ -1305,6 +1380,7 @@ advance_generation (struct Set *set) | |||
1305 | r); | 1380 | r); |
1306 | } | 1381 | } |
1307 | 1382 | ||
1383 | |||
1308 | /** | 1384 | /** |
1309 | * Called when a client wants to initiate a set operation with another | 1385 | * Called when a client wants to initiate a set operation with another |
1310 | * peer. Initiates the CADET connection to the listener and sends the | 1386 | * peer. Initiates the CADET connection to the listener and sends the |
@@ -1355,10 +1431,13 @@ handle_client_evaluate (void *cls, | |||
1355 | GNUNET_CONTAINER_DLL_insert (set->ops_head, | 1431 | GNUNET_CONTAINER_DLL_insert (set->ops_head, |
1356 | set->ops_tail, | 1432 | set->ops_tail, |
1357 | op); | 1433 | op); |
1434 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1435 | "Creating new CADET channel to port %s\n", | ||
1436 | GNUNET_h2s (&msg->app_id)); | ||
1358 | op->channel = GNUNET_CADET_channel_create (cadet, | 1437 | op->channel = GNUNET_CADET_channel_create (cadet, |
1359 | op, | 1438 | op, |
1360 | &msg->target_peer, | 1439 | &msg->target_peer, |
1361 | GC_u2h (GNUNET_APPLICATION_TYPE_SET), | 1440 | &msg->app_id, |
1362 | GNUNET_CADET_OPTION_RELIABLE); | 1441 | GNUNET_CADET_OPTION_RELIABLE); |
1363 | op->mq = GNUNET_CADET_mq_create (op->channel); | 1442 | op->mq = GNUNET_CADET_mq_create (op->channel); |
1364 | set->vt->evaluate (op, | 1443 | set->vt->evaluate (op, |
@@ -1534,7 +1613,8 @@ handle_client_copy_lazy_connect (void *cls, | |||
1534 | return; | 1613 | return; |
1535 | } | 1614 | } |
1536 | 1615 | ||
1537 | if (NULL == set->vt->copy_state) { | 1616 | if (NULL == set->vt->copy_state) |
1617 | { | ||
1538 | /* Lazy copy not supported for this set operation */ | 1618 | /* Lazy copy not supported for this set operation */ |
1539 | GNUNET_break (0); | 1619 | GNUNET_break (0); |
1540 | GNUNET_free (set); | 1620 | GNUNET_free (set); |
@@ -1735,108 +1815,12 @@ shutdown_task (void *cls) | |||
1735 | 1815 | ||
1736 | 1816 | ||
1737 | /** | 1817 | /** |
1738 | * Timeout happens iff: | ||
1739 | * - we suggested an operation to our listener, | ||
1740 | * but did not receive a response in time | ||
1741 | * - we got the channel from a peer but no #GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST | ||
1742 | * | ||
1743 | * @param cls channel context | ||
1744 | * @param tc context information (why was this task triggered now) | ||
1745 | */ | ||
1746 | static void | ||
1747 | incoming_timeout_cb (void *cls) | ||
1748 | { | ||
1749 | struct Operation *incoming = cls; | ||
1750 | |||
1751 | incoming->timeout_task = NULL; | ||
1752 | GNUNET_assert (GNUNET_YES == incoming->is_incoming); | ||
1753 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1754 | "Remote peer's incoming request timed out\n"); | ||
1755 | incoming_destroy (incoming); | ||
1756 | } | ||
1757 | |||
1758 | |||
1759 | /** | ||
1760 | * Terminates an incoming operation in case we have not yet received an | ||
1761 | * operation request. Called by the channel destruction handler. | ||
1762 | * | ||
1763 | * @param op the channel context | ||
1764 | */ | ||
1765 | static void | ||
1766 | handle_incoming_disconnect (struct Operation *op) | ||
1767 | { | ||
1768 | GNUNET_assert (GNUNET_YES == op->is_incoming); | ||
1769 | /* channel is already dead, incoming_destroy must not | ||
1770 | * destroy it ... */ | ||
1771 | op->channel = NULL; | ||
1772 | incoming_destroy (op); | ||
1773 | op->vt = NULL; | ||
1774 | } | ||
1775 | |||
1776 | |||
1777 | /** | ||
1778 | * Method called whenever another peer has added us to a channel the | ||
1779 | * other peer initiated. Only called (once) upon reception of data | ||
1780 | * with a message type which was subscribed to in | ||
1781 | * GNUNET_CADET_connect(). | ||
1782 | * | ||
1783 | * The channel context represents the operation itself and gets added to a DLL, | ||
1784 | * from where it gets looked up when our local listener client responds | ||
1785 | * to a proposed/suggested operation or connects and associates with this operation. | ||
1786 | * | ||
1787 | * @param cls closure | ||
1788 | * @param channel new handle to the channel | ||
1789 | * @param initiator peer that started the channel | ||
1790 | * @param port Port this channel is for. | ||
1791 | * @param options Unused. | ||
1792 | * @return initial channel context for the channel | ||
1793 | * returns NULL on error | ||
1794 | */ | ||
1795 | static void * | ||
1796 | channel_new_cb (void *cls, | ||
1797 | struct GNUNET_CADET_Channel *channel, | ||
1798 | const struct GNUNET_PeerIdentity *initiator, | ||
1799 | const struct GNUNET_HashCode *port, | ||
1800 | enum GNUNET_CADET_ChannelOption options) | ||
1801 | { | ||
1802 | static const struct SetVT incoming_vt = { | ||
1803 | .msg_handler = &handle_incoming_msg, | ||
1804 | .peer_disconnect = &handle_incoming_disconnect | ||
1805 | }; | ||
1806 | struct Operation *incoming; | ||
1807 | |||
1808 | if (0 != memcmp (GC_u2h (GNUNET_APPLICATION_TYPE_SET), port, sizeof (*port))) | ||
1809 | { | ||
1810 | GNUNET_break (0); | ||
1811 | GNUNET_CADET_channel_destroy (channel); | ||
1812 | return NULL; | ||
1813 | } | ||
1814 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1815 | "New incoming channel\n"); | ||
1816 | incoming = GNUNET_new (struct Operation); | ||
1817 | incoming->is_incoming = GNUNET_YES; | ||
1818 | incoming->peer = *initiator; | ||
1819 | incoming->channel = channel; | ||
1820 | incoming->mq = GNUNET_CADET_mq_create (incoming->channel); | ||
1821 | incoming->vt = &incoming_vt; | ||
1822 | incoming->timeout_task | ||
1823 | = GNUNET_SCHEDULER_add_delayed (INCOMING_CHANNEL_TIMEOUT, | ||
1824 | &incoming_timeout_cb, | ||
1825 | incoming); | ||
1826 | GNUNET_CONTAINER_DLL_insert_tail (incoming_head, | ||
1827 | incoming_tail, | ||
1828 | incoming); | ||
1829 | return incoming; | ||
1830 | } | ||
1831 | |||
1832 | |||
1833 | /** | ||
1834 | * Function called whenever a channel is destroyed. Should clean up | 1818 | * Function called whenever a channel is destroyed. Should clean up |
1835 | * any associated state. It must NOT call | 1819 | * any associated state. It must NOT call |
1836 | * GNUNET_CADET_channel_destroy() on the channel. | 1820 | * GNUNET_CADET_channel_destroy() on the channel. |
1837 | * | 1821 | * |
1838 | * The peer_disconnect function is part of a a virtual table set initially either | 1822 | * The peer_disconnect function is part of a a virtual table set initially either |
1839 | * when a peer creates a new channel with us (#channel_new_cb()), or once we create | 1823 | * when a peer creates a new channel with us, or once we create |
1840 | * a new channel ourselves (evaluate). | 1824 | * a new channel ourselves (evaluate). |
1841 | * | 1825 | * |
1842 | * Once we know the exact type of operation (union/intersection), the vt is | 1826 | * Once we know the exact type of operation (union/intersection), the vt is |
@@ -1881,7 +1865,7 @@ channel_end_cb (void *cls, | |||
1881 | * received via a cadet channel. | 1865 | * received via a cadet channel. |
1882 | * | 1866 | * |
1883 | * The msg_handler is a virtual table set in initially either when a peer | 1867 | * The msg_handler is a virtual table set in initially either when a peer |
1884 | * creates a new channel with us (channel_new_cb), or once we create a new channel | 1868 | * creates a new channel with us, or once we create a new channel |
1885 | * ourselves (evaluate). | 1869 | * ourselves (evaluate). |
1886 | * | 1870 | * |
1887 | * Once we know the exact type of operation (union/intersection), the vt is | 1871 | * Once we know the exact type of operation (union/intersection), the vt is |
@@ -1992,16 +1976,15 @@ run (void *cls, | |||
1992 | configuration = cfg; | 1976 | configuration = cfg; |
1993 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); | 1977 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); |
1994 | GNUNET_SERVER_disconnect_notify (server, | 1978 | GNUNET_SERVER_disconnect_notify (server, |
1995 | &handle_client_disconnect, NULL); | 1979 | &handle_client_disconnect, |
1980 | NULL); | ||
1996 | GNUNET_SERVER_add_handlers (server, | 1981 | GNUNET_SERVER_add_handlers (server, |
1997 | server_handlers); | 1982 | server_handlers); |
1998 | _GSS_statistics = GNUNET_STATISTICS_create ("set", cfg); | 1983 | _GSS_statistics = GNUNET_STATISTICS_create ("set", cfg); |
1999 | cadet = GNUNET_CADET_connect (cfg, NULL, | 1984 | cadet = GNUNET_CADET_connect (cfg, |
1985 | NULL, | ||
2000 | &channel_end_cb, | 1986 | &channel_end_cb, |
2001 | cadet_handlers); | 1987 | cadet_handlers); |
2002 | GNUNET_CADET_open_port (cadet, | ||
2003 | GC_u2h (GNUNET_APPLICATION_TYPE_SET), | ||
2004 | &channel_new_cb, NULL); | ||
2005 | if (NULL == cadet) | 1988 | if (NULL == cadet) |
2006 | { | 1989 | { |
2007 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1990 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
diff --git a/src/set/gnunet-service-set.h b/src/set/gnunet-service-set.h index de9dfbded..9e1ffd01a 100644 --- a/src/set/gnunet-service-set.h +++ b/src/set/gnunet-service-set.h | |||
@@ -336,6 +336,9 @@ struct ElementEntry | |||
336 | }; | 336 | }; |
337 | 337 | ||
338 | 338 | ||
339 | struct Listener; | ||
340 | |||
341 | |||
339 | /** | 342 | /** |
340 | * Operation context used to execute a set operation. | 343 | * Operation context used to execute a set operation. |
341 | */ | 344 | */ |
@@ -354,6 +357,11 @@ struct Operation | |||
354 | struct GNUNET_CADET_Channel *channel; | 357 | struct GNUNET_CADET_Channel *channel; |
355 | 358 | ||
356 | /** | 359 | /** |
360 | * Port this operation runs on. | ||
361 | */ | ||
362 | struct Listener *listener; | ||
363 | |||
364 | /** | ||
357 | * Message queue for the channel. | 365 | * Message queue for the channel. |
358 | */ | 366 | */ |
359 | struct GNUNET_MQ_Handle *mq; | 367 | struct GNUNET_MQ_Handle *mq; |
diff --git a/src/set/gnunet-service-set_intersection.c b/src/set/gnunet-service-set_intersection.c index e9d97f6a8..258ad6443 100644 --- a/src/set/gnunet-service-set_intersection.c +++ b/src/set/gnunet-service-set_intersection.c | |||
@@ -1036,7 +1036,6 @@ intersection_evaluate (struct Operation *op, | |||
1036 | return; | 1036 | return; |
1037 | } | 1037 | } |
1038 | msg->operation = htonl (GNUNET_SET_OPERATION_INTERSECTION); | 1038 | msg->operation = htonl (GNUNET_SET_OPERATION_INTERSECTION); |
1039 | msg->app_id = op->spec->app_id; | ||
1040 | msg->element_count = htonl (op->state->my_element_count); | 1039 | msg->element_count = htonl (op->state->my_element_count); |
1041 | GNUNET_MQ_send (op->mq, | 1040 | GNUNET_MQ_send (op->mq, |
1042 | ev); | 1041 | ev); |
diff --git a/src/set/gnunet-service-set_protocol.h b/src/set/gnunet-service-set_protocol.h index 97cf40a63..748da15fc 100644 --- a/src/set/gnunet-service-set_protocol.h +++ b/src/set/gnunet-service-set_protocol.h | |||
@@ -52,7 +52,7 @@ struct OperationRequestMessage | |||
52 | /** | 52 | /** |
53 | * Application-specific identifier of the request. | 53 | * Application-specific identifier of the request. |
54 | */ | 54 | */ |
55 | struct GNUNET_HashCode app_id; | 55 | struct GNUNET_HashCode app_idX; |
56 | 56 | ||
57 | /* rest: optional message */ | 57 | /* rest: optional message */ |
58 | }; | 58 | }; |
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c index 669e34c8f..6a1072a30 100644 --- a/src/set/gnunet-service-set_union.c +++ b/src/set/gnunet-service-set_union.c | |||
@@ -1597,7 +1597,6 @@ union_evaluate (struct Operation *op, | |||
1597 | return; | 1597 | return; |
1598 | } | 1598 | } |
1599 | msg->operation = htonl (GNUNET_SET_OPERATION_UNION); | 1599 | msg->operation = htonl (GNUNET_SET_OPERATION_UNION); |
1600 | msg->app_id = op->spec->app_id; | ||
1601 | GNUNET_MQ_send (op->mq, | 1600 | GNUNET_MQ_send (op->mq, |
1602 | ev); | 1601 | ev); |
1603 | 1602 | ||
diff --git a/src/set/test_set.conf b/src/set/test_set.conf index 30ccbde55..69e7f5c52 100644 --- a/src/set/test_set.conf +++ b/src/set/test_set.conf | |||
@@ -5,7 +5,7 @@ GNUNET_TEST_HOME = /tmp/test-gnunet-set/ | |||
5 | 5 | ||
6 | [set] | 6 | [set] |
7 | AUTOSTART = YES | 7 | AUTOSTART = YES |
8 | PREFIX = valgrind | 8 | # PREFIX = valgrind |
9 | #PREFIX = valgrind --leak-check=full | 9 | #PREFIX = valgrind --leak-check=full |
10 | #PREFIX = gdbserver :1234 | 10 | #PREFIX = gdbserver :1234 |
11 | OPTIONS = -L INFO | 11 | OPTIONS = -L INFO |
diff --git a/src/set/test_set_api.c b/src/set/test_set_api.c index 19d63d00b..eea47f57d 100644 --- a/src/set/test_set_api.c +++ b/src/set/test_set_api.c | |||
@@ -151,7 +151,7 @@ listen_cb (void *cls, | |||
151 | GNUNET_SET_RESULT_ADDED, | 151 | GNUNET_SET_RESULT_ADDED, |
152 | &result_cb_set2, | 152 | &result_cb_set2, |
153 | NULL); | 153 | NULL); |
154 | GNUNET_SET_commit (oh, | 154 | GNUNET_SET_commit (oh2, |
155 | set2); | 155 | set2); |
156 | } | 156 | } |
157 | 157 | ||