aboutsummaryrefslogtreecommitdiff
path: root/src/set/gnunet-service-set_union.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/set/gnunet-service-set_union.c')
-rw-r--r--src/set/gnunet-service-set_union.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index 219cc6235..73d3f5c83 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2013-2017 GNUnet e.V. 3 Copyright (C) 2013-2017 GNUnet e.V.
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 it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file set/gnunet-service-set_union.c 19 * @file set/gnunet-service-set_union.c
@@ -760,8 +758,8 @@ get_order_from_difference (unsigned int diff)
760 */ 758 */
761static int 759static int
762send_full_element_iterator (void *cls, 760send_full_element_iterator (void *cls,
763 const struct GNUNET_HashCode *key, 761 const struct GNUNET_HashCode *key,
764 void *value) 762 void *value)
765{ 763{
766 struct Operation *op = cls; 764 struct Operation *op = cls;
767 struct GNUNET_SET_ElementMessage *emsg; 765 struct GNUNET_SET_ElementMessage *emsg;
@@ -1373,7 +1371,8 @@ send_client_element (struct Operation *op,
1373 * 1371 *
1374 * @param op operation 1372 * @param op operation
1375 */ 1373 */
1376void destroy_channel (struct Operation *op) 1374static void
1375destroy_channel (struct Operation *op)
1377{ 1376{
1378 struct GNUNET_CADET_Channel *channel; 1377 struct GNUNET_CADET_Channel *channel;
1379 1378
@@ -1400,13 +1399,18 @@ send_client_done (void *cls)
1400 struct GNUNET_MQ_Envelope *ev; 1399 struct GNUNET_MQ_Envelope *ev;
1401 struct GNUNET_SET_ResultMessage *rm; 1400 struct GNUNET_SET_ResultMessage *rm;
1402 1401
1403 if (GNUNET_YES == op->state->client_done_sent) { 1402 if (GNUNET_YES == op->state->client_done_sent)
1403 {
1404 return; 1404 return;
1405 } 1405 }
1406 1406
1407 if (PHASE_DONE != op->state->phase) { 1407 if (PHASE_DONE != op->state->phase) {
1408 LOG (GNUNET_ERROR_TYPE_WARNING, 1408 LOG (GNUNET_ERROR_TYPE_WARNING,
1409 "union operation failed\n"); 1409 "Union operation failed\n");
1410 GNUNET_STATISTICS_update (_GSS_statistics,
1411 "# Union operations failed",
1412 1,
1413 GNUNET_NO);
1410 ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT); 1414 ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT);
1411 rm->result_status = htons (GNUNET_SET_STATUS_FAILURE); 1415 rm->result_status = htons (GNUNET_SET_STATUS_FAILURE);
1412 rm->request_id = htonl (op->client_request_id); 1416 rm->request_id = htonl (op->client_request_id);
@@ -1418,6 +1422,10 @@ send_client_done (void *cls)
1418 1422
1419 op->state->client_done_sent = GNUNET_YES; 1423 op->state->client_done_sent = GNUNET_YES;
1420 1424
1425 GNUNET_STATISTICS_update (_GSS_statistics,
1426 "# Union operations succeeded",
1427 1,
1428 GNUNET_NO);
1421 LOG (GNUNET_ERROR_TYPE_INFO, 1429 LOG (GNUNET_ERROR_TYPE_INFO,
1422 "Signalling client that union operation is done\n"); 1430 "Signalling client that union operation is done\n");
1423 ev = GNUNET_MQ_msg (rm, 1431 ev = GNUNET_MQ_msg (rm,
@@ -1469,7 +1477,7 @@ maybe_finish (struct Operation *op)
1469 { 1477 {
1470 op->state->phase = PHASE_DONE; 1478 op->state->phase = PHASE_DONE;
1471 send_client_done (op); 1479 send_client_done (op);
1472 destroy_channel (op); 1480 _GSS_operation_destroy2 (op);
1473 } 1481 }
1474 } 1482 }
1475} 1483}
@@ -1898,7 +1906,7 @@ handle_union_p2p_full_done (void *cls,
1898 op->state->phase = PHASE_DONE; 1906 op->state->phase = PHASE_DONE;
1899 GNUNET_CADET_receive_done (op->channel); 1907 GNUNET_CADET_receive_done (op->channel);
1900 send_client_done (op); 1908 send_client_done (op);
1901 destroy_channel (op); 1909 _GSS_operation_destroy2 (op);
1902 return; 1910 return;
1903 } 1911 }
1904 break; 1912 break;
@@ -2151,7 +2159,7 @@ handle_union_p2p_done (void *cls,
2151 * 2159 *
2152 * We should notify the active peer once 2160 * We should notify the active peer once
2153 * all our demands are satisfied, so that the active 2161 * all our demands are satisfied, so that the active
2154 * peer can quit if we gave him everything. 2162 * peer can quit if we gave it everything.
2155 */ 2163 */
2156 GNUNET_CADET_receive_done (op->channel); 2164 GNUNET_CADET_receive_done (op->channel);
2157 maybe_finish (op); 2165 maybe_finish (op);
@@ -2196,7 +2204,7 @@ handle_union_p2p_over (void *cls,
2196 * 2204 *
2197 * @param op operation to perform (to be initialized) 2205 * @param op operation to perform (to be initialized)
2198 * @param opaque_context message to be transmitted to the listener 2206 * @param opaque_context message to be transmitted to the listener
2199 * to convince him to accept, may be NULL 2207 * to convince it to accept, may be NULL
2200 */ 2208 */
2201static struct OperationState * 2209static struct OperationState *
2202union_evaluate (struct Operation *op, 2210union_evaluate (struct Operation *op,