diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-04-04 22:04:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-04-04 22:04:00 +0000 |
commit | 0663125e0f41ee120736944ef153074f6251b957 (patch) | |
tree | 975543b6194c87b076547f63d8c344b87e21e75a /src/fs/gnunet-publish.c | |
parent | 4b78e6983509f2078c4f52888187436c0a7b6aeb (diff) | |
download | gnunet-0663125e0f41ee120736944ef153074f6251b957.tar.gz gnunet-0663125e0f41ee120736944ef153074f6251b957.zip |
bugfixes, more tests
Diffstat (limited to 'src/fs/gnunet-publish.c')
-rw-r--r-- | src/fs/gnunet-publish.c | 62 |
1 files changed, 59 insertions, 3 deletions
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index bcfc8967b..767e84af2 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c | |||
@@ -46,6 +46,8 @@ static struct GNUNET_CONTAINER_MetaData *meta; | |||
46 | 46 | ||
47 | static struct GNUNET_FS_Uri *topKeywords; | 47 | static struct GNUNET_FS_Uri *topKeywords; |
48 | 48 | ||
49 | static struct GNUNET_FS_Uri *uri; | ||
50 | |||
49 | static unsigned int anonymity = 1; | 51 | static unsigned int anonymity = 1; |
50 | 52 | ||
51 | static unsigned int priority = 365; | 53 | static unsigned int priority = 365; |
@@ -328,10 +330,31 @@ publish_inspector (void *cls, | |||
328 | 330 | ||
329 | 331 | ||
330 | static void | 332 | static void |
333 | uri_sks_continuation (void *cls, | ||
334 | const struct GNUNET_FS_Uri *ksk_uri, | ||
335 | const char *emsg) | ||
336 | { | ||
337 | if (emsg != NULL) | ||
338 | { | ||
339 | fprintf (stderr, | ||
340 | "%s\n", | ||
341 | emsg); | ||
342 | ret = 1; | ||
343 | } | ||
344 | GNUNET_FS_uri_destroy (uri); | ||
345 | uri = NULL; | ||
346 | GNUNET_FS_stop (ctx); | ||
347 | ctx = NULL; | ||
348 | } | ||
349 | |||
350 | |||
351 | static void | ||
331 | uri_ksk_continuation (void *cls, | 352 | uri_ksk_continuation (void *cls, |
332 | const struct GNUNET_FS_Uri *uri, | 353 | const struct GNUNET_FS_Uri *ksk_uri, |
333 | const char *emsg) | 354 | const char *emsg) |
334 | { | 355 | { |
356 | struct GNUNET_FS_Namespace *ns; | ||
357 | |||
335 | if (emsg != NULL) | 358 | if (emsg != NULL) |
336 | { | 359 | { |
337 | fprintf (stderr, | 360 | fprintf (stderr, |
@@ -339,7 +362,40 @@ uri_ksk_continuation (void *cls, | |||
339 | emsg); | 362 | emsg); |
340 | ret = 1; | 363 | ret = 1; |
341 | } | 364 | } |
365 | if (pseudonym != NULL) | ||
366 | { | ||
367 | ns = GNUNET_FS_namespace_create (ctx, | ||
368 | pseudonym); | ||
369 | if (ns == NULL) | ||
370 | { | ||
371 | fprintf (stderr, | ||
372 | _("Failed to create namespace `%s'\n"), | ||
373 | pseudonym); | ||
374 | ret = 1; | ||
375 | } | ||
376 | else | ||
377 | { | ||
378 | GNUNET_FS_publish_sks (ctx, | ||
379 | ns, | ||
380 | this_id, | ||
381 | next_id, | ||
382 | meta, | ||
383 | uri, | ||
384 | GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION), | ||
385 | anonymity, | ||
386 | priority, | ||
387 | GNUNET_FS_PUBLISH_OPTION_NONE, | ||
388 | uri_sks_continuation, | ||
389 | NULL); | ||
390 | GNUNET_assert (GNUNET_OK == | ||
391 | GNUNET_FS_namespace_delete (ns, GNUNET_NO)); | ||
392 | return; | ||
393 | } | ||
394 | } | ||
395 | GNUNET_FS_uri_destroy (uri); | ||
396 | uri = NULL; | ||
342 | GNUNET_FS_stop (ctx); | 397 | GNUNET_FS_stop (ctx); |
398 | ctx = NULL; | ||
343 | } | 399 | } |
344 | 400 | ||
345 | 401 | ||
@@ -365,7 +421,6 @@ run (void *cls, | |||
365 | struct stat sbuf; | 421 | struct stat sbuf; |
366 | char *ex; | 422 | char *ex; |
367 | char *emsg; | 423 | char *emsg; |
368 | struct GNUNET_FS_Uri *uri; | ||
369 | 424 | ||
370 | sched = s; | 425 | sched = s; |
371 | /* check arguments */ | 426 | /* check arguments */ |
@@ -419,7 +474,8 @@ run (void *cls, | |||
419 | return; | 474 | return; |
420 | } | 475 | } |
421 | } | 476 | } |
422 | if (args[0] == NULL) | 477 | if ( (args[0] == NULL) && |
478 | (uri_string == NULL) ) | ||
423 | { | 479 | { |
424 | fprintf (stderr, | 480 | fprintf (stderr, |
425 | _("Need the name of a file to publish!\n")); | 481 | _("Need the name of a file to publish!\n")); |