ibf_order++;
if (ibf_order > MAX_IBF_ORDER)
ibf_order = MAX_IBF_ORDER;
- return ibf_order;
+ // add one for correction
+ return ibf_order + 1;
}
{
struct Operation *op = cls;
struct GNUNET_SET_ElementMessage *emsg;
- struct GNUNET_SET_Element *el = value;
+ struct ElementEntry *ee = value;
+ struct GNUNET_SET_Element *el = &ee->element;
struct GNUNET_MQ_Envelope *ev;
+
ev = GNUNET_MQ_msg_extra (emsg, el->size, GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_ELEMENT);
- emsg->element_type = htonl (el->element_type);
+ emsg->element_type = htons (el->element_type);
GNUNET_memcpy (&emsg[1], el->data, el->size);
GNUNET_MQ_send (op->mq, ev);
return GNUNET_YES;
GNUNET_assert (NULL != op->state->se);
diff = strata_estimator_difference (remote_se,
op->state->se);
+
+ if (diff > 200)
+ diff = diff * 3 / 2;
+
strata_estimator_destroy (remote_se);
strata_estimator_destroy (op->state->se);
op->state->se = NULL;
}
- if ( (GNUNET_YES == op->spec->force_full) || (diff > op->state->initial_size / 2))
+ if ( (GNUNET_YES == op->spec->force_full) || (diff > op->state->initial_size / 4))
{
LOG (GNUNET_ERROR_TYPE_INFO,
"Sending full set (diff=%d, own set=%u)\n",
diff,
op->state->initial_size);
+ GNUNET_STATISTICS_update (_GSS_statistics,
+ "# of full sends",
+ 1,
+ GNUNET_NO);
if (op->state->initial_size <= other_size)
{
send_full_set (op);
}
else
{
+ GNUNET_STATISTICS_update (_GSS_statistics,
+ "# of ibf sends",
+ 1,
+ GNUNET_NO);
if (GNUNET_OK !=
send_ibf (op,
get_order_from_difference (diff)))
}
rm->result_status = htons (status);
rm->request_id = htonl (op->spec->client_request_id);
- rm->element_type = element->element_type;
+ rm->element_type = htons (element->element_type);
+ rm->current_size = GNUNET_htonll (GNUNET_CONTAINER_multihashmap32_size (op->state->key_to_element));
GNUNET_memcpy (&rm[1], element->data, element->size);
GNUNET_MQ_send (op->spec->set->client_mq, ev);
}
rm->request_id = htonl (op->spec->client_request_id);
rm->result_status = htons (GNUNET_SET_STATUS_DONE);
rm->element_type = htons (0);
+ rm->current_size = GNUNET_htonll (GNUNET_CONTAINER_multihashmap32_size (op->state->key_to_element));
GNUNET_MQ_send (op->spec->set->client_mq, ev);
/* Will also call the union-specific cancel function. */
_GSS_operation_destroy (op, GNUNET_YES);
}
}
- if (op->state->received_total > 8 && op->state->received_fresh < op->state->received_total / 3)
+ if ( (GNUNET_YES == op->spec->byzantine) &&
+ (op->state->received_total > 384 + op->state->received_fresh * 4) &&
+ (op->state->received_fresh < op->state->received_total / 6) )
{
/* The other peer gave us lots of old elements, there's something wrong. */
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "Other peer sent only %llu/%llu fresh elements, failing operation\n",
+ (unsigned long long) op->state->received_fresh,
+ (unsigned long long) op->state->received_total);
GNUNET_break_op (0);
fail_union_operation (op);
return;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"sent op request without context message\n");
- op->state->initial_size = GNUNET_CONTAINER_multihashmap_size (op->spec->set->content->elements);
initialize_key_to_element (op);
+ op->state->initial_size = GNUNET_CONTAINER_multihashmap32_size (op->state->key_to_element);
}
op->state->se = strata_estimator_dup (op->spec->set->state->se);
op->state->demanded_hashes = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO);
op->state->salt_receive = op->state->salt_send = 42;
- op->state->initial_size = GNUNET_CONTAINER_multihashmap_size (op->spec->set->content->elements);
initialize_key_to_element (op);
+ op->state->initial_size = GNUNET_CONTAINER_multihashmap32_size (op->state->key_to_element);
/* kick off the operation */
send_strata_estimator (op);
}