if (wr > 0)
total += wr;
} while ( (wr > 0) && (total < size) );
+ if (wr <= 0)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Failed to write to inter thread communication pipe: %s\n",
+ strerror (errno));
return (total == size) ? GNUNET_OK : GNUNET_SYSERR;
}
}
/* this is the expensive operation, *afterwards* we'll check for aborts */
+ fprintf (stderr, "\tCalling extract on `%s'\n", item->filename);
GNUNET_FS_meta_data_extract_from_file (item->meta,
item->filename,
ds->plugins);
+ fprintf (stderr, "\tExtract `%s' done\n", item->filename);
/* having full filenames is too dangerous; always make sure we clean them up */
GNUNET_CONTAINER_meta_data_delete (item->meta,
ds->filename_expanded,
&ds->toplevel))
{
- (void) write_progress (ds, "", GNUNET_NO, GNUNET_FS_DIRSCANNER_INTERNAL_ERROR);
+ (void) write_progress (ds, "", GNUNET_SYSERR, GNUNET_FS_DIRSCANNER_INTERNAL_ERROR);
+ GNUNET_DISK_pipe_close_end (ds->progress_pipe, GNUNET_DISK_PIPE_END_WRITE);
return 0;
}
if (GNUNET_OK !=
- write_progress (ds, "", GNUNET_NO, GNUNET_FS_DIRSCANNER_ALL_COUNTED))
+ write_progress (ds, "", GNUNET_SYSERR, GNUNET_FS_DIRSCANNER_ALL_COUNTED))
+ {
+ GNUNET_DISK_pipe_close_end (ds->progress_pipe, GNUNET_DISK_PIPE_END_WRITE);
return 0;
+ }
if (GNUNET_OK !=
extract_files (ds, ds->toplevel))
{
- (void) write_progress (ds, "", GNUNET_NO, GNUNET_FS_DIRSCANNER_INTERNAL_ERROR);
+ (void) write_progress (ds, "", GNUNET_SYSERR, GNUNET_FS_DIRSCANNER_INTERNAL_ERROR);
+ GNUNET_DISK_pipe_close_end (ds->progress_pipe, GNUNET_DISK_PIPE_END_WRITE);
return 0;
}
- (void) write_progress (ds, "", GNUNET_NO, GNUNET_FS_DIRSCANNER_FINISHED);
+ (void) write_progress (ds, "", GNUNET_SYSERR, GNUNET_FS_DIRSCANNER_FINISHED);
+ GNUNET_DISK_pipe_close_end (ds->progress_pipe, GNUNET_DISK_PIPE_END_WRITE);
return 0;
}
if (rd > 0)
total += rd;
} while ( (rd > 0) && (total < size) );
+ if (rd <= 0)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Failed to read from inter thread communication pipe: %s\n",
+ strerror (errno));
return (total == size) ? GNUNET_OK : GNUNET_SYSERR;
}
char *filename;
ds->progress_read_task = GNUNET_SCHEDULER_NO_TASK;
- if (! (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY))
+ if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY))
{
ds->progress_read_task
= GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
}
/* schedule task to keep reading (done here in case client calls
abort or something similar) */
- if ( (reason != GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED) &&
+ if ( (reason != GNUNET_FS_DIRSCANNER_FINISHED) &&
(reason != GNUNET_FS_DIRSCANNER_INTERNAL_ERROR) )
+ {
ds->progress_read_task
= GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
ds->progress_read,
&read_progress_task, ds);
-
+ }
/* read successfully, notify client about progress */
ds->progress_callback (ds->progress_callback_cls,
ds,
struct KeywordCounter *counter = value;
if (counter->count >= tc->move_threshold)
- GNUNET_FS_uri_ksk_add_keyword (tc->pos->ksk_uri, counter->value, GNUNET_NO);
+ {
+ if (NULL == tc->pos->ksk_uri)
+ tc->pos->ksk_uri = GNUNET_FS_uri_ksk_create_from_args (1, &counter->value);
+ else
+ GNUNET_FS_uri_ksk_add_keyword (tc->pos->ksk_uri, counter->value, GNUNET_NO);
+ }
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_remove (tc->keywordcounter,
key,
for (pos = tree->children_head; NULL != pos; pos = pos->next)
{
GNUNET_CONTAINER_meta_data_iterate (pos->meta, &add_to_meta_counter, tc->metacounter);
- GNUNET_FS_uri_ksk_get_keywords (pos->ksk_uri, &add_to_keyword_counter, tc->keywordcounter);
+ if (NULL != pos->ksk_uri)
+ GNUNET_FS_uri_ksk_get_keywords (pos->ksk_uri, &add_to_keyword_counter, tc->keywordcounter);
}
/* calculate threshold for moving keywords / meta data */
for (pos = tree->children_head; NULL != pos; pos = pos->next)
{
tc->pos = pos;
- GNUNET_FS_uri_ksk_get_keywords (pos->ksk_uri, &remove_high_frequency_keywords, tc);
+ if (NULL != pos->ksk_uri)
+ GNUNET_FS_uri_ksk_get_keywords (pos->ksk_uri, &remove_high_frequency_keywords, tc);
}
/* add high-frequency meta data and keywords to parent */
ctx = NULL;
}
+
static struct GNUNET_FS_FileInformation *
get_file_information (struct GNUNET_FS_ShareTreeItem *item)
{
GNUNET_CONTAINER_meta_data_delete (item->meta,
EXTRACTOR_METATYPE_MIMETYPE, NULL, 0);
GNUNET_FS_meta_data_make_directory (item->meta);
- GNUNET_FS_uri_ksk_add_keyword (item->ksk_uri, GNUNET_FS_DIRECTORY_MIME,
+ if (NULL == item->ksk_uri)
+ {
+ const char *mime = GNUNET_FS_DIRECTORY_MIME;
+ item->ksk_uri = GNUNET_FS_uri_ksk_create_from_args (1, &mime);
+ }
+ else
+ GNUNET_FS_uri_ksk_add_keyword (item->ksk_uri, GNUNET_FS_DIRECTORY_MIME,
GNUNET_NO);
fi = GNUNET_FS_file_information_create_empty_directory (
ctx, NULL, item->ksk_uri,
GNUNET_assert (0);
break;
}
+ fflush (stdout);
}