projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
indentation fixes
[oweals/gnunet.git]
/
src
/
set
/
gnunet-service-set_intersection.c
diff --git
a/src/set/gnunet-service-set_intersection.c
b/src/set/gnunet-service-set_intersection.c
index ed29033b451e3f9fd529a54f0b408ed2b10eac35..258ad64436494fd02d5beca0007026f9c9b12ac1 100644
(file)
--- a/
src/set/gnunet-service-set_intersection.c
+++ b/
src/set/gnunet-service-set_intersection.c
@@
-1,6
+1,6
@@
/*
This file is part of GNUnet
/*
This file is part of GNUnet
- (C) 2013, 2014 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2013, 2014 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@
-14,8
+14,8
@@
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 5
9 Temple Place - Suite 330
,
- Boston, MA 0211
1-1307
, USA.
+ Free Software Foundation, Inc., 5
1 Franklin Street, Fifth Floor
,
+ Boston, MA 0211
0-1301
, USA.
*/
/**
* @file set/gnunet-service-set_intersection.c
*/
/**
* @file set/gnunet-service-set_intersection.c
@@
-59,6
+59,7
@@
enum IntersectionOperationPhase
* client.
*/
PHASE_FINISHED
* client.
*/
PHASE_FINISHED
+
};
};
@@
-208,7
+209,7
@@
send_client_removed_element (struct Operation *op,
rm->result_status = htons (GNUNET_SET_STATUS_OK);
rm->request_id = htonl (op->spec->client_request_id);
rm->element_type = element->element_type;
rm->result_status = htons (GNUNET_SET_STATUS_OK);
rm->request_id = htonl (op->spec->client_request_id);
rm->element_type = element->element_type;
- memcpy (&rm[1],
+
GNUNET_
memcpy (&rm[1],
element->data,
element->size);
GNUNET_MQ_send (op->spec->set->client_mq,
element->data,
element->size);
GNUNET_MQ_send (op->spec->set->client_mq,
@@
-239,8
+240,7
@@
filtered_map_initialization (void *cls,
GNUNET_h2s (&ee->element_hash),
ee->element.size);
GNUNET_h2s (&ee->element_hash),
ee->element.size);
- if ( (op->generation_created < ee->generation_removed) &&
- (op->generation_created >= ee->generation_added) )
+ if (GNUNET_NO == _GSS_is_element_of_operation (ee, op))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Reduced initialization, not starting with %s:%u (wrong generation)\n",
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Reduced initialization, not starting with %s:%u (wrong generation)\n",
@@
-483,7
+483,7
@@
send_bloomfilter (struct Operation *op)
ev = GNUNET_MQ_msg_extra (msg,
chunk_size,
GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF);
ev = GNUNET_MQ_msg_extra (msg,
chunk_size,
GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF);
- memcpy (&msg[1],
+
GNUNET_
memcpy (&msg[1],
&bf_data[offset],
chunk_size);
offset += chunk_size;
&bf_data[offset],
chunk_size);
offset += chunk_size;
@@
-549,13
+549,15
@@
send_remaining_elements (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending done and destroy because iterator ran out\n");
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending done and destroy because iterator ran out\n");
+ op->keep--;
send_client_done_and_destroy (op);
return;
}
ee = nxt;
element = &ee->element;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
send_client_done_and_destroy (op);
return;
}
ee = nxt;
element = &ee->element;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending element (size %u) to client (full set)\n",
+ "Sending element %s:%u to client (full set)\n",
+ GNUNET_h2s (&ee->element_hash),
element->size);
GNUNET_assert (0 != op->spec->client_request_id);
ev = GNUNET_MQ_msg_extra (rm,
element->size);
GNUNET_assert (0 != op->spec->client_request_id);
ev = GNUNET_MQ_msg_extra (rm,
@@
-565,7
+567,7
@@
send_remaining_elements (void *cls)
rm->result_status = htons (GNUNET_SET_STATUS_OK);
rm->request_id = htonl (op->spec->client_request_id);
rm->element_type = element->element_type;
rm->result_status = htons (GNUNET_SET_STATUS_OK);
rm->request_id = htonl (op->spec->client_request_id);
rm->element_type = element->element_type;
- memcpy (&rm[1],
+
GNUNET_
memcpy (&rm[1],
element->data,
element->size);
GNUNET_MQ_notify_sent (ev,
element->data,
element->size);
GNUNET_MQ_notify_sent (ev,
@@
-615,7
+617,7
@@
process_bf (struct Operation *op)
op->state->phase,
op->spec->remote_element_count,
op->state->my_element_count,
op->state->phase,
op->spec->remote_element_count,
op->state->my_element_count,
- GNUNET_CONTAINER_multihashmap_size (op->spec->set->elements));
+ GNUNET_CONTAINER_multihashmap_size (op->spec->set->
content->
elements));
switch (op->state->phase)
{
case PHASE_INITIAL:
switch (op->state->phase)
{
case PHASE_INITIAL:
@@
-629,7
+631,7
@@
process_bf (struct Operation *op)
= GNUNET_CONTAINER_multihashmap_create (op->spec->remote_element_count,
GNUNET_YES);
op->state->my_element_count = 0;
= GNUNET_CONTAINER_multihashmap_create (op->spec->remote_element_count,
GNUNET_YES);
op->state->my_element_count = 0;
- GNUNET_CONTAINER_multihashmap_iterate (op->spec->set->elements,
+ GNUNET_CONTAINER_multihashmap_iterate (op->spec->set->
content->
elements,
&filtered_map_initialization,
op);
break;
&filtered_map_initialization,
op);
break;
@@
-742,7
+744,7
@@
handle_p2p_bf (void *cls,
return;
}
}
return;
}
}
- memcpy (&op->state->bf_data[op->state->bf_data_offset],
+
GNUNET_
memcpy (&op->state->bf_data[op->state->bf_data_offset],
(const char*) &msg[1],
chunk_size);
op->state->bf_data_offset += chunk_size;
(const char*) &msg[1],
chunk_size);
op->state->bf_data_offset += chunk_size;
@@
-784,8
+786,7
@@
initialize_map_unfiltered (void *cls,
struct ElementEntry *ee = value;
struct Operation *op = cls;
struct ElementEntry *ee = value;
struct Operation *op = cls;
- if ( (op->generation_created < ee->generation_removed) &&
- (op->generation_created >= ee->generation_added) )
+ if (GNUNET_NO == _GSS_is_element_of_operation (ee, op))
return GNUNET_YES; /* element not live in operation's generation */
GNUNET_CRYPTO_hash_xor (&op->state->my_xor,
&ee->element_hash,
return GNUNET_YES; /* element not live in operation's generation */
GNUNET_CRYPTO_hash_xor (&op->state->my_xor,
&ee->element_hash,
@@
-838,7
+839,7
@@
begin_bf_exchange (struct Operation *op)
op->state->my_elements
= GNUNET_CONTAINER_multihashmap_create (op->state->my_element_count,
GNUNET_YES);
op->state->my_elements
= GNUNET_CONTAINER_multihashmap_create (op->state->my_element_count,
GNUNET_YES);
- GNUNET_CONTAINER_multihashmap_iterate (op->spec->set->elements,
+ GNUNET_CONTAINER_multihashmap_iterate (op->spec->set->
content->
elements,
&initialize_map_unfiltered,
op);
send_bloomfilter (op);
&initialize_map_unfiltered,
op);
send_bloomfilter (op);
@@
-901,9
+902,11
@@
finish_and_destroy (struct Operation *op)
if (GNUNET_SET_RESULT_FULL == op->spec->result_mode)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
if (GNUNET_SET_RESULT_FULL == op->spec->result_mode)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending full result set\n");
+ "Sending full result set (%u elements)\n",
+ GNUNET_CONTAINER_multihashmap_size (op->state->my_elements));
op->state->full_result_iter
= GNUNET_CONTAINER_multihashmap_iterator_create (op->state->my_elements);
op->state->full_result_iter
= GNUNET_CONTAINER_multihashmap_iterator_create (op->state->my_elements);
+ op->keep++;
send_remaining_elements (op);
return;
}
send_remaining_elements (op);
return;
}
@@
-993,7
+996,8
@@
handle_p2p_done (void *cls,
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Got final DONE\n");
+ "Got IntersectionDoneMessage, have %u elements in intersection\n",
+ op->state->my_element_count);
op->state->phase = PHASE_FINISHED;
finish_and_destroy (op);
}
op->state->phase = PHASE_FINISHED;
finish_and_destroy (op);
}
@@
-1032,10
+1036,10
@@
intersection_evaluate (struct Operation *op,
return;
}
msg->operation = htonl (GNUNET_SET_OPERATION_INTERSECTION);
return;
}
msg->operation = htonl (GNUNET_SET_OPERATION_INTERSECTION);
- msg->app_id = op->spec->app_id;
msg->element_count = htonl (op->state->my_element_count);
GNUNET_MQ_send (op->mq,
ev);
msg->element_count = htonl (op->state->my_element_count);
GNUNET_MQ_send (op->mq,
ev);
+ op->state->phase = PHASE_COUNT_SENT;
if (NULL != opaque_context)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sent op request with context message\n");
if (NULL != opaque_context)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sent op request with context message\n");