aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_namestore_api_create_update.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-03-05 09:09:52 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-03-05 09:09:52 +0000
commitb2a772525198768d93100aacaf00376ef0d17404 (patch)
treeafb57e9a43dfb9eaa2cccdb72a278e05be962416 /src/namestore/test_namestore_api_create_update.c
parent3023629d236c50dff73e8c5c74fc6d4bc004e906 (diff)
downloadgnunet-b2a772525198768d93100aacaf00376ef0d17404.tar.gz
gnunet-b2a772525198768d93100aacaf00376ef0d17404.zip
- expiration update
Diffstat (limited to 'src/namestore/test_namestore_api_create_update.c')
-rw-r--r--src/namestore/test_namestore_api_create_update.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/namestore/test_namestore_api_create_update.c b/src/namestore/test_namestore_api_create_update.c
index 2c91a00f4..22313aca9 100644
--- a/src/namestore/test_namestore_api_create_update.c
+++ b/src/namestore/test_namestore_api_create_update.c
@@ -19,7 +19,7 @@
19*/ 19*/
20/** 20/**
21 * @file namestore/test_namestore_api.c 21 * @file namestore/test_namestore_api.c
22 * @brief testcase for namestore_api.c 22 * @brief testcase for namestore_api.c for updating an existing record
23 */ 23 */
24#include "platform.h" 24#include "platform.h"
25#include "gnunet_common.h" 25#include "gnunet_common.h"
@@ -321,36 +321,40 @@ void
321create_updated_cont (void *cls, int32_t success, const char *emsg) 321create_updated_cont (void *cls, int32_t success, const char *emsg)
322{ 322{
323 char *name = cls; 323 char *name = cls;
324 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Create record for `%s': %s `%s'\n", name, ((success == GNUNET_YES) || (success == GNUNET_NO)) ? "SUCCESS" : "FAIL", emsg); 324 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating expiration for record `%s': %s `%s'\n", name, ((success == GNUNET_YES) || (success == GNUNET_NO)) ? "SUCCESS" : "FAIL", emsg);
325 if (success == GNUNET_OK) 325 if (success == GNUNET_NO)
326 { 326 {
327 res = 0; 327 res = 0;
328 GNUNET_SCHEDULER_add_now(&end, NULL); 328 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Updated record for name `%s'\n", name);
329 }
330 if (success == GNUNET_OK)
331 {
332 res = 1;
333 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "FAIL, Create new record for name `%s'\n", name);
329 } 334 }
330 else 335 else
331 { 336 {
332 res = 1; 337 res = 1;
333 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to put records for name `%s'\n", name); 338 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create records for name `%s'\n", name);
334 GNUNET_SCHEDULER_add_now(&end, NULL);
335 } 339 }
336 340 GNUNET_SCHEDULER_add_now(&end, NULL);
337} 341}
338 342
339void 343void
340create_identical_cont (void *cls, int32_t success, const char *emsg) 344create_identical_cont (void *cls, int32_t success, const char *emsg)
341{ 345{
342 char *name = cls; 346 char *name = cls;
343 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Create updated record for `%s': %s `%s'\n", name, ((success == GNUNET_YES) || (success == GNUNET_NO)) ? "SUCCESS" : "FAIL", emsg); 347 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating identical record for `%s': %s `%s'\n", name, ((success == GNUNET_YES) || (success == GNUNET_NO)) ? "SUCCESS" : "FAIL", emsg);
344 if (success == GNUNET_OK) 348 if (success == GNUNET_NO)
345 { 349 {
346 res = 0; 350 res = 0;
347 s_first_record->expiration = GNUNET_TIME_absolute_get_zero(); 351 s_first_record->expiration = GNUNET_TIME_absolute_get ();
348 GNUNET_NAMESTORE_record_create (nsh, privkey, s_name, s_first_record, &create_updated_cont, s_name); 352 GNUNET_NAMESTORE_record_create (nsh, privkey, s_name, s_first_record, &create_updated_cont, s_name);
349 } 353 }
350 else 354 else
351 { 355 {
352 res = 1; 356 res = 1;
353 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to put records for name `%s'\n", name); 357 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating identical record for `%s': %s `%s'\n", name, ((success == GNUNET_YES) || (success == GNUNET_NO)) ? "SUCCESS" : "FAIL", emsg);
354 GNUNET_SCHEDULER_add_now(&end, NULL); 358 GNUNET_SCHEDULER_add_now(&end, NULL);
355 } 359 }
356 360
@@ -402,7 +406,7 @@ create_record (int count)
402 406
403 for (c = 0; c < count; c++) 407 for (c = 0; c < count; c++)
404 { 408 {
405 rd[c].expiration = GNUNET_TIME_absolute_get(); 409 rd[c].expiration = GNUNET_TIME_absolute_get_zero();
406 rd[c].record_type = TEST_RECORD_TYPE; 410 rd[c].record_type = TEST_RECORD_TYPE;
407 rd[c].data_size = TEST_RECORD_DATALEN; 411 rd[c].data_size = TEST_RECORD_DATALEN;
408 rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); 412 rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);