case GNUNET_SET_STATUS_FAILURE:
printf ("set 1: failure\n");
ret = 1;
+ GNUNET_SCHEDULER_shutdown ();
break;
case GNUNET_SET_STATUS_DONE:
printf ("set 1: done\n");
GNUNET_SET_destroy (set1);
+ set1 = NULL;
+ if (NULL == set2)
+ GNUNET_SCHEDULER_shutdown ();
break;
default:
GNUNET_assert (0);
case GNUNET_SET_STATUS_FAILURE:
printf ("set 2: failure\n");
ret = 1;
+ GNUNET_SCHEDULER_shutdown ();
break;
case GNUNET_SET_STATUS_DONE:
printf ("set 2: done\n");
GNUNET_SET_destroy (set2);
+ set2 = NULL;
+ if (NULL == set1)
+ GNUNET_SCHEDULER_shutdown ();
break;
default:
GNUNET_assert (0);
listen_handle = GNUNET_SET_listen (config, GNUNET_SET_OPERATION_UNION,
&app_id, listen_cb, NULL);
- oh = GNUNET_SET_prepare (&local_id, &app_id, &context_msg, 42,
+ oh = GNUNET_SET_prepare (&local_id, &app_id, &context_msg,
GNUNET_SET_RESULT_FULL,
result_cb_set1, NULL);
GNUNET_SET_commit (oh, set1);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initializing set 2\n");
- element.type = 0;
+ element.element_type = 0;
element.data = "hello";
element.size = strlen(element.data);
{
struct GNUNET_SET_Element element;
- element.type = 0;
+ element.element_type = 0;
element.data = "hello";
element.size = strlen(element.data);
iter_set = GNUNET_SET_create (config, GNUNET_SET_OPERATION_UNION);
- element.type = 0;
+ element.element_type = 0;
element.data = "hello";
element.size = strlen(element.data);
}
+/**
+ * Signature of the main function of a task.
+ *
+ * @param cls closure
+ * @param tc context information (why was this task triggered now)
+ */
+static void
+timeout_fail (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
+ return;
+ GNUNET_SCHEDULER_shutdown ();
+ ret = 1;
+}
+
+
/**
* Signature of the 'main' function for a (single-peer) testcase that
* is run using 'GNUNET_TESTING_peer_run'.
const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_TESTING_Peer *peer)
{
+
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5),
+ &timeout_fail, NULL);
+
config = cfg;
GNUNET_CRYPTO_get_peer_identity (cfg, &local_id);
printf ("my id (from CRYPTO): %s\n", GNUNET_i2s (&local_id));
"test_set.conf",
&run, NULL))
{
- return 0;
+ return 1;
}
return ret;
}