#define DEFAULT_NUM_PEERS 2
/* test records to resolve */
-#define TEST_DOMAIN "www.alice.bob.gnunet"
+#define TEST_DOMAIN "www.alice.bob.gads"
#define TEST_IP "127.0.0.1"
#define TEST_RECORD_NAME "www"
#define TEST_AUTHORITY_BOB "bob"
#define TEST_AUTHORITY_ALICE "alice"
#define TEST_ALICE_PSEU "carol"
-#define TEST_EXPECTED_RESULT "www.carol.gnunet"
+#define TEST_EXPECTED_RESULT "www.carol.gads"
#define KEYFILE_BOB "../namestore/zonefiles/HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"
#define KEYFILE_ALICE "../namestore/zonefiles/N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"
struct GNUNET_CRYPTO_ShortHashCode priv_zone;
struct GNUNET_CRYPTO_ShortHashCode short_zone;
+
+/**
+ * Check if the get_handle is being used, if so stop the request. Either
+ * way, schedule the end_badly_cont function which actually shuts down the
+ * test.
+ */
+static void
+end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ die_task = GNUNET_SCHEDULER_NO_TASK;
+ GNUNET_SCHEDULER_shutdown ();
+ ok = 1;
+}
+
+void end_badly_now ()
+{
+ GNUNET_SCHEDULER_cancel (die_task);
+ die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
+}
+
+
/**
* Called when gns shorten finishes
*/
{
GNUNET_GNS_disconnect(gns_handle);
+ if (GNUNET_SCHEDULER_NO_TASK != die_task)
+ {
+ GNUNET_SCHEDULER_cancel (die_task);
+ die_task = GNUNET_SCHEDULER_NO_TASK;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Disconnecting from namestore\n");
GNUNET_NAMESTORE_disconnect (namestore_handle);
- ok = 0;
if (sname == NULL)
{
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to connect to gns\n");
- ok = 1;
+ end_badly_now ();
return;
}
}
-/**
- * Check if the get_handle is being used, if so stop the request. Either
- * way, schedule the end_badly_cont function which actually shuts down the
- * test.
- */
-static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- ok = 1;
-}
-
void do_check (void *cls,
const struct GNUNET_CONFIGURATION_Handle *ccfg,
if (NULL == namestore_handle)
{
GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to connect to namestore\n");
- ok = -1;
+ end_badly_now ();
return;
}
&our_keyfile))
{
GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to get key from cfg\n");
- ok = -1;
+ end_badly_now ();
return;
}
{
GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
"Failed to get shorten zone key from cfg\n");
- ok = -1;
+ end_badly_now ();
return;
}
{
GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
"Failed to get private zone key from cfg\n");
- ok = -1;
+ end_badly_now ();
return;
}
NULL);
GNUNET_TESTING_peer_run ("test-gns-simple-shorten", "test_gns_simple_lookup.conf", &do_check, NULL);
-
return ok;
}