diff options
Diffstat (limited to 'src/fs/gnunet-publish.c')
-rw-r--r-- | src/fs/gnunet-publish.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index 1e0884361..70964590d 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009, 2010 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -68,6 +68,8 @@ static int extract_only; | |||
68 | 68 | ||
69 | static int do_disable_creation_time; | 69 | static int do_disable_creation_time; |
70 | 70 | ||
71 | static GNUNET_SCHEDULER_TaskIdentifier kill_task; | ||
72 | |||
71 | 73 | ||
72 | static void | 74 | static void |
73 | do_stop_task (void *cls, | 75 | do_stop_task (void *cls, |
@@ -124,6 +126,12 @@ progress_cb (void *cls, | |||
124 | fprintf (stderr, | 126 | fprintf (stderr, |
125 | _("Error publishing: %s.\n"), | 127 | _("Error publishing: %s.\n"), |
126 | info->value.publish.specifics.error.message); | 128 | info->value.publish.specifics.error.message); |
129 | if (kill_task != GNUNET_SCHEDULER_NO_TASK) | ||
130 | { | ||
131 | GNUNET_SCHEDULER_cancel (sched, | ||
132 | kill_task); | ||
133 | kill_task = GNUNET_SCHEDULER_NO_TASK; | ||
134 | } | ||
127 | GNUNET_SCHEDULER_add_continuation (sched, | 135 | GNUNET_SCHEDULER_add_continuation (sched, |
128 | &do_stop_task, | 136 | &do_stop_task, |
129 | NULL, | 137 | NULL, |
@@ -133,11 +141,24 @@ progress_cb (void *cls, | |||
133 | fprintf (stdout, | 141 | fprintf (stdout, |
134 | _("Publishing `%s' done.\n"), | 142 | _("Publishing `%s' done.\n"), |
135 | info->value.publish.filename); | 143 | info->value.publish.filename); |
144 | s = GNUNET_FS_uri_to_string (info->value.publish.specifics.completed.chk_uri); | ||
145 | fprintf (stdout, | ||
146 | _("URI is `%s'.\n"), | ||
147 | s); | ||
148 | GNUNET_free (s); | ||
136 | if (info->value.publish.pctx == NULL) | 149 | if (info->value.publish.pctx == NULL) |
137 | GNUNET_SCHEDULER_add_continuation (sched, | 150 | { |
138 | &do_stop_task, | 151 | if (kill_task != GNUNET_SCHEDULER_NO_TASK) |
139 | NULL, | 152 | { |
140 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 153 | GNUNET_SCHEDULER_cancel (sched, |
154 | kill_task); | ||
155 | kill_task = GNUNET_SCHEDULER_NO_TASK; | ||
156 | } | ||
157 | GNUNET_SCHEDULER_add_continuation (sched, | ||
158 | &do_stop_task, | ||
159 | NULL, | ||
160 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
161 | } | ||
141 | break; | 162 | break; |
142 | case GNUNET_FS_STATUS_PUBLISH_STOPPED: | 163 | case GNUNET_FS_STATUS_PUBLISH_STOPPED: |
143 | GNUNET_break (NULL == pc); | 164 | GNUNET_break (NULL == pc); |
@@ -547,6 +568,10 @@ run (void *cls, | |||
547 | ret = 1; | 568 | ret = 1; |
548 | return; | 569 | return; |
549 | } | 570 | } |
571 | kill_task = GNUNET_SCHEDULER_add_delayed (sched, | ||
572 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
573 | &do_stop_task, | ||
574 | NULL); | ||
550 | } | 575 | } |
551 | 576 | ||
552 | 577 | ||