el.data = &msg[1];
el.element_type = ntohs (msg->element_type);
GNUNET_SET_element_hash (&el, &hash);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Client inserts element %s of size %u\n",
- GNUNET_h2s (&hash),
- el.size);
ee = GNUNET_CONTAINER_multihashmap_get (set->content->elements,
&hash);
if (NULL == ee)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Client inserts element %s of size %u\n",
+ GNUNET_h2s (&hash),
+ el.size);
ee = GNUNET_malloc (el.size + sizeof *ee);
ee->element.size = el.size;
GNUNET_memcpy (&ee[1],
}
else if (GNUNET_YES == _GSS_is_element_of_set (ee, set))
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Client inserted element %s of size %u twice (ignored)\n",
+ GNUNET_h2s (&hash),
+ el.size);
+
/* same element inserted twice */
return;
}
.generation = set->current_generation,
.added = GNUNET_YES
};
- GNUNET_array_append (ee->mutations, ee->mutations_size, mut);
+ GNUNET_array_append (ee->mutations,
+ ee->mutations_size,
+ mut);
}
set->vt->add (set->state, ee);
msg = (const struct GNUNET_SET_ElementMessage *) m;
el.size = ntohs (m->size) - sizeof *msg;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Client removes element of size %u\n",
- el.size);
el.data = &msg[1];
el.element_type = ntohs (msg->element_type);
GNUNET_SET_element_hash (&el, &hash);
if (NULL == ee)
{
/* Client tried to remove non-existing element. */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Client removes non-existing element of size %u\n",
+ el.size);
return;
}
if (GNUNET_NO == _GSS_is_element_of_set (ee, set))
{
/* Client tried to remove element twice */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Client removed element of size %u twice (ignored)\n",
+ el.size);
return;
}
else
.generation = set->current_generation,
.added = GNUNET_NO
};
- GNUNET_array_append (ee->mutations, ee->mutations_size, mut);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Client removes element of size %u\n",
+ el.size);
+
+ GNUNET_array_append (ee->mutations,
+ ee->mutations_size,
+ mut);
}
set->vt->remove (set->state, ee);
}
pm = GNUNET_new (struct PendingMutation);
pm->mutation_message = GNUNET_copy_message (m);
pm->set = set;
- GNUNET_CONTAINER_DLL_insert (set->content->pending_mutations_head,
- set->content->pending_mutations_tail,
- pm);
+ GNUNET_CONTAINER_DLL_insert_tail (set->content->pending_mutations_head,
+ set->content->pending_mutations_tail,
+ pm);
return;
}
execute_mutation (set, m);
cont (cont_cls);
return GNUNET_SYSERR;
}
- mqm = GNUNET_MQ_msg_extra (msg, element->size,
+ mqm = GNUNET_MQ_msg_extra (msg,
+ element->size,
GNUNET_MESSAGE_TYPE_SET_ADD);
msg->element_type = htons (element->element_type);
GNUNET_memcpy (&msg[1],
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Expected count (what: %s) to be %u, but it's actually %u\n",
ci_cls->what,
- ci_cls->expected_count, ci_cls->ongoing_count);
+ ci_cls->expected_count,
+ ci_cls->ongoing_count);
ret = 1;
GNUNET_SCHEDULER_shutdown ();
return GNUNET_NO;
ci_cls->cont (ci_cls->cont_cls);
return GNUNET_NO;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Set `%s' has element %.*s\n",
+ ci_cls->what,
+ (int) element->size,
+ (const char *) element->data);
- ci_cls->ongoing_count += 1;
+ ci_cls->ongoing_count++;
return GNUNET_YES;
}
{
struct CountIterClosure *ci_cls = GNUNET_new (struct CountIterClosure);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Checking count of %s\n",
+ what);
+
ci_cls->expected_count = expected_count;
ci_cls->ongoing_count = 0;
ci_cls->cont = cont;
{
check_count (set2,
"new set",
- 4,
+ 3,
&test_done,
NULL);
}
copy_done (void *cls,
struct GNUNET_SET_Handle *new_set)
{
- printf ("copy done\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "copy done\n");
set2 = new_set;
- remove_element_str (set2, "spam");
- add_element_str (set2, "new1");
- add_element_str (set2, "new2");
- remove_element_str (set2, "new2");
- remove_element_str (set2, "new3");
+ remove_element_str (set2,
+ "k5555");
+ add_element_str (set2,
+ "n66666");
+ add_element_str (set2,
+ "new2butremoved");
+ remove_element_str (set2,
+ "new2butremoved");
+ remove_element_str (set2,
+ "new3justremoved");
// Check that set1 didn't change.
- check_count (set1, "old set", 3,
+ check_count (set1,
+ "old set",
+ 3,
&check_new_set_count,
NULL);
}
static void
test_copy (void *cls)
{
- printf ("about to copy\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "about to copy\n");
GNUNET_SET_copy_lazy (set1,
©_done,
NULL);
&local_id);
set1 = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION);
- add_element_str (set1, "foo");
- add_element_str (set1, "bar");
+ add_element_str (set1,
+ "333");
+ add_element_str (set1,
+ "k444");
/* duplicate -- ignored */
- add_element_str (set1, "bar");
- remove_element_str (set1, "foo");
+ add_element_str (set1,
+ "k444");
+ remove_element_str (set1,
+ "333");
/* non-existent -- ignored */
- remove_element_str (set1, "nonexist1");
- add_element_str (set1, "spam");
+ remove_element_str (set1,
+ "999999999");
+ add_element_str (set1,
+ "k5555");
/* duplicate -- ignored */
- remove_element_str (set1, "foo");
- add_element_str (set1, "eggs");
+ remove_element_str (set1,
+ "333");
+ add_element_str (set1,
+ "k2");
check_count (set1,
"initial test",