X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fnamestore%2Ftest_namestore_api_create_update.c;h=1601b39d80b093165e48e1808c9469b89f9c715f;hb=d0b4927e6ab7e8b9874dd7807055e77fb4c5163f;hp=e898a30504f62539f31b4f4aaf1ce4e2969637cf;hpb=15f55fea6e6d2d1656e345eab131887efbd937b4;p=oweals%2Fgnunet.git diff --git a/src/namestore/test_namestore_api_create_update.c b/src/namestore/test_namestore_api_create_update.c index e898a3050..1601b39d8 100644 --- a/src/namestore/test_namestore_api_create_update.c +++ b/src/namestore/test_namestore_api_create_update.c @@ -43,7 +43,7 @@ #define TEST_CREATE_RECORD_DATA 'b' -#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) +#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) static struct GNUNET_NAMESTORE_Handle * nsh; @@ -77,7 +77,7 @@ static void endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (nsh != NULL) - GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); + GNUNET_NAMESTORE_disconnect (nsh); nsh = NULL; if (privkey != NULL) GNUNET_CRYPTO_rsa_key_free (privkey); @@ -101,7 +101,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_CRYPTO_rsa_key_free (privkey); privkey = NULL; if (nsh != NULL) - GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); + GNUNET_NAMESTORE_disconnect (nsh); nsh = NULL; } @@ -138,7 +138,7 @@ create_identical_cont (void *cls, int32_t success, const char *emsg) if (success == GNUNET_NO) { res = 0; - s_first_record->expiration = GNUNET_TIME_absolute_get (); + s_first_record->expiration_time = GNUNET_TIME_absolute_get ().abs_value; GNUNET_NAMESTORE_record_create (nsh, privkey, s_name, s_first_record, &create_updated_cont, s_name); } else @@ -173,31 +173,32 @@ create_first_cont (void *cls, int32_t success, const char *emsg) static struct GNUNET_NAMESTORE_RecordData * -create_record (int count) +create_record (unsigned int count) { - int c; + unsigned int c; struct GNUNET_NAMESTORE_RecordData * rd; - rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); + rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); for (c = 0; c < count; c++) { - rd[c].expiration = GNUNET_TIME_UNIT_ZERO_ABS; + rd[c].expiration_time = 0; rd[c].record_type = TEST_RECORD_TYPE; rd[c].data_size = TEST_RECORD_DATALEN; rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); } - return rd; } static void run (void *cls, - const struct GNUNET_CONFIGURATION_Handle *cfg) + const struct GNUNET_CONFIGURATION_Handle *cfg, + struct GNUNET_TESTING_Peer *peer) { size_t rd_ser_len; char *hostkey_file; + struct GNUNET_TIME_Absolute et; endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); @@ -219,7 +220,8 @@ run (void *cls, char rd_ser[rd_ser_len]; GNUNET_NAMESTORE_records_serialize(1, s_first_record, rd_ser_len, rd_ser); - s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_first_record->expiration, s_name, s_first_record, 1); + et.abs_value = s_first_record->expiration_time; + s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_first_record, 1); /* create random zone hash */ GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);