aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fs/fs_api.h6
-rw-r--r--src/fs/fs_publish.c50
-rw-r--r--src/fs/gnunet-publish.c20
-rw-r--r--src/util/client.c5
-rw-r--r--src/util/os_priority.c1
5 files changed, 63 insertions, 19 deletions
diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h
index 5ff0c4f1d..9ecffb88d 100644
--- a/src/fs/fs_api.h
+++ b/src/fs/fs_api.h
@@ -1325,6 +1325,12 @@ struct GNUNET_FS_PublishContext
1325 int rid; 1325 int rid;
1326 1326
1327 /** 1327 /**
1328 * Set to #GNUNET_YES if we were able to publish any block.
1329 * (and thus unindexing on error might make sense).
1330 */
1331 int any_done;
1332
1333 /**
1328 * Set to #GNUNET_YES if all processing has completed. 1334 * Set to #GNUNET_YES if all processing has completed.
1329 */ 1335 */
1330 int all_done; 1336 int all_done;
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index 211f800e6..d9c732ee8 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -112,7 +112,8 @@ publish_cleanup (struct GNUNET_FS_PublishContext *pc)
112 * @param msg error message (or NULL) 112 * @param msg error message (or NULL)
113 */ 113 */
114static void 114static void
115ds_put_cont (void *cls, int success, 115ds_put_cont (void *cls,
116 int success,
116 struct GNUNET_TIME_Absolute min_expiration, 117 struct GNUNET_TIME_Absolute min_expiration,
117 const char *msg) 118 const char *msg)
118{ 119{
@@ -130,14 +131,19 @@ ds_put_cont (void *cls, int success,
130 pi.value.publish.specifics.error.message = pc->fi_pos->emsg; 131 pi.value.publish.specifics.error.message = pc->fi_pos->emsg;
131 pc->fi_pos->client_info = 132 pc->fi_pos->client_info =
132 GNUNET_FS_publish_make_status_ (&pi, pc, pc->fi_pos, 0); 133 GNUNET_FS_publish_make_status_ (&pi, pc, pc->fi_pos, 0);
133 if ((pc->fi_pos->is_directory != GNUNET_YES) && 134 if ((GNUNET_YES != pc->fi_pos->is_directory) &&
134 (pc->fi_pos->filename != NULL) && 135 (NULL != pc->fi_pos->filename) &&
135 (pc->fi_pos->data.file.do_index == GNUNET_YES)) 136 (GNUNET_YES == pc->any_done) &&
137 (GNUNET_YES == pc->fi_pos->data.file.do_index))
136 { 138 {
137 /* run unindex to clean up */ 139 /* run unindex to clean up */
138 GNUNET_FS_unindex_start (pc->h, pc->fi_pos->filename, NULL); 140 GNUNET_FS_unindex_start (pc->h,
141 pc->fi_pos->filename,
142 NULL);
139 } 143 }
144 return;
140 } 145 }
146 pc->any_done = GNUNET_YES;
141 GNUNET_assert (NULL == pc->upload_task); 147 GNUNET_assert (NULL == pc->upload_task);
142 pc->upload_task = 148 pc->upload_task =
143 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, 149 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND,
@@ -506,26 +512,40 @@ block_proc (void *cls,
506 odb.file_id = p->data.file.file_id; 512 odb.file_id = p->data.file.file_id;
507 GNUNET_assert (pc->qre == NULL); 513 GNUNET_assert (pc->qre == NULL);
508 pc->qre = 514 pc->qre =
509 GNUNET_DATASTORE_put (pc->dsh, (p->is_directory == GNUNET_YES) ? 0 : pc->rid, 515 GNUNET_DATASTORE_put (pc->dsh,
510 &chk->query, sizeof (struct OnDemandBlock), &odb, 516 (p->is_directory == GNUNET_YES) ? 0 : pc->rid,
517 &chk->query,
518 sizeof (struct OnDemandBlock),
519 &odb,
511 GNUNET_BLOCK_TYPE_FS_ONDEMAND, 520 GNUNET_BLOCK_TYPE_FS_ONDEMAND,
512 p->bo.content_priority, p->bo.anonymity_level, 521 p->bo.content_priority,
513 p->bo.replication_level, p->bo.expiration_time, 522 p->bo.anonymity_level,
514 -2, 1, GNUNET_CONSTANTS_SERVICE_TIMEOUT, 523 p->bo.replication_level,
524 p->bo.expiration_time,
525 -2, 1,
526 GNUNET_CONSTANTS_SERVICE_TIMEOUT,
515 &ds_put_cont, pc); 527 &ds_put_cont, pc);
516 return; 528 return;
517 } 529 }
518 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 530 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
519 "Publishing block `%s' for offset %llu with size %u\n", 531 "Publishing block `%s' for offset %llu with size %u\n",
520 GNUNET_h2s (&chk->query), (unsigned long long) offset, 532 GNUNET_h2s (&chk->query),
533 (unsigned long long) offset,
521 (unsigned int) block_size); 534 (unsigned int) block_size);
522 GNUNET_assert (pc->qre == NULL); 535 GNUNET_assert (pc->qre == NULL);
523 pc->qre = 536 pc->qre =
524 GNUNET_DATASTORE_put (pc->dsh, (p->is_directory == GNUNET_YES) ? 0 : pc->rid, 537 GNUNET_DATASTORE_put (pc->dsh, (p->is_directory == GNUNET_YES) ? 0 : pc->rid,
525 &chk->query, block_size, block, type, 538 &chk->query,
526 p->bo.content_priority, p->bo.anonymity_level, 539 block_size,
527 p->bo.replication_level, p->bo.expiration_time, -2, 540 block,
528 1, GNUNET_CONSTANTS_SERVICE_TIMEOUT, &ds_put_cont, 541 type,
542 p->bo.content_priority,
543 p->bo.anonymity_level,
544 p->bo.replication_level,
545 p->bo.expiration_time,
546 -2, 1,
547 GNUNET_CONSTANTS_SERVICE_TIMEOUT,
548 &ds_put_cont,
529 pc); 549 pc);
530} 550}
531 551
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index 975f5d2ad..b213218e4 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -293,15 +293,29 @@ progress_cb (void *cls,
293 case GNUNET_FS_STATUS_PUBLISH_STOPPED: 293 case GNUNET_FS_STATUS_PUBLISH_STOPPED:
294 GNUNET_break (NULL == pc); 294 GNUNET_break (NULL == pc);
295 return NULL; 295 return NULL;
296 case GNUNET_FS_STATUS_UNINDEX_START:
297 FPRINTF (stderr,
298 "%s",
299 _("Starting cleanup after abort\n"));
300 return NULL;
296 case GNUNET_FS_STATUS_UNINDEX_PROGRESS: 301 case GNUNET_FS_STATUS_UNINDEX_PROGRESS:
297 return NULL; 302 return NULL;
298 case GNUNET_FS_STATUS_UNINDEX_COMPLETED: 303 case GNUNET_FS_STATUS_UNINDEX_COMPLETED:
299 FPRINTF (stderr, 304 FPRINTF (stderr,
300 "%s", 305 "%s",
301 _("Cleanup after abort complete.\n")); 306 _("Cleanup after abort completed.\n"));
307 GNUNET_FS_unindex_stop (info->value.unindex.uc);
308 return NULL;
309 case GNUNET_FS_STATUS_UNINDEX_ERROR:
310 FPRINTF (stderr,
311 "%s",
312 _("Cleanup after abort failed.\n"));
313 GNUNET_FS_unindex_stop (info->value.unindex.uc);
302 return NULL; 314 return NULL;
303 default: 315 default:
304 FPRINTF (stderr, _("Unexpected status: %d\n"), info->status); 316 FPRINTF (stderr,
317 _("Unexpected status: %d\n"),
318 info->status);
305 return NULL; 319 return NULL;
306 } 320 }
307 return ""; /* non-null */ 321 return ""; /* non-null */
@@ -316,7 +330,7 @@ progress_cb (void *cls,
316 * @param plugin_name name of the plugin that generated the meta data 330 * @param plugin_name name of the plugin that generated the meta data
317 * @param type type of the meta data 331 * @param type type of the meta data
318 * @param format format of data 332 * @param format format of data
319 * @param data_mime_type mime type of data 333 * @param data_mime_type mime type of @a data
320 * @param data value of the meta data 334 * @param data value of the meta data
321 * @param data_size number of bytes in @a data 335 * @param data_size number of bytes in @a data
322 * @return always 0 336 * @return always 0
diff --git a/src/util/client.c b/src/util/client.c
index 46bb6a86b..ad48c31a8 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -70,7 +70,7 @@ struct GNUNET_CLIENT_TransmitHandle
70 * If we are re-trying and are delaying to do so, 70 * If we are re-trying and are delaying to do so,
71 * handle to the scheduled task managing the delay. 71 * handle to the scheduled task managing the delay.
72 */ 72 */
73 struct GNUNET_SCHEDULER_Task * reconnect_task; 73 struct GNUNET_SCHEDULER_Task *reconnect_task;
74 74
75 /** 75 /**
76 * Timeout for the operation overall. 76 * Timeout for the operation overall.
@@ -1108,6 +1108,7 @@ client_delayed_retry (void *cls,
1108 "Transmission failed %u times, trying again in %s.\n", 1108 "Transmission failed %u times, trying again in %s.\n",
1109 MAX_ATTEMPTS - th->attempts_left, 1109 MAX_ATTEMPTS - th->attempts_left,
1110 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); 1110 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
1111 GNUNET_assert (NULL == th->th);
1111 GNUNET_assert (NULL == th->reconnect_task); 1112 GNUNET_assert (NULL == th->reconnect_task);
1112 th->reconnect_task = 1113 th->reconnect_task =
1113 GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th); 1114 GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th);
@@ -1191,6 +1192,7 @@ client_notify (void *cls,
1191 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); 1192 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
1192 client->th = th; 1193 client->th = th;
1193 GNUNET_assert (NULL == th->reconnect_task); 1194 GNUNET_assert (NULL == th->reconnect_task);
1195 GNUNET_assert (NULL == th->th);
1194 th->reconnect_task = 1196 th->reconnect_task =
1195 GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th); 1197 GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th);
1196 return 0; 1198 return 0;
@@ -1259,6 +1261,7 @@ GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *client,
1259 client->th = th; 1261 client->th = th;
1260 if (NULL == client->connection) 1262 if (NULL == client->connection)
1261 { 1263 {
1264 GNUNET_assert (NULL == th->th);
1262 GNUNET_assert (NULL == th->reconnect_task); 1265 GNUNET_assert (NULL == th->reconnect_task);
1263 th->reconnect_task = 1266 th->reconnect_task =
1264 GNUNET_SCHEDULER_add_delayed (client->back_off, 1267 GNUNET_SCHEDULER_add_delayed (client->back_off,
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index 480ca09bb..065009ae5 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -492,6 +492,7 @@ open_dev_null (int target_fd,
492 * (when they are non-NULL). 492 * (when they are non-NULL).
493 * @param pipe_stdin pipe to use to send input to child process (or NULL) 493 * @param pipe_stdin pipe to use to send input to child process (or NULL)
494 * @param pipe_stdout pipe to use to get output from child process (or NULL) 494 * @param pipe_stdout pipe to use to get output from child process (or NULL)
495 * @param pipe_stderr pipe to use for stderr for child process (or NULL)
495 * @param lsocks array of listen sockets to dup systemd-style (or NULL); 496 * @param lsocks array of listen sockets to dup systemd-style (or NULL);
496 * must be NULL on platforms where dup is not supported 497 * must be NULL on platforms where dup is not supported
497 * @param filename name of the binary 498 * @param filename name of the binary