array_clear(&storage->open_files);
}
+void dbox_files_sync_input(struct dbox_storage *storage)
+{
+ struct dbox_file *const *files;
+ unsigned int i, count;
+
+ files = array_get(&storage->open_files, &count);
+ for (i = 0; i < count; i++) {
+ if (files[i]->input != NULL)
+ i_stream_sync(files[i]->input);
+ }
+}
+
static void
dbox_close_open_files(struct dbox_storage *storage, unsigned int close_count)
{
/* Free all currently opened files. */
void dbox_files_free(struct dbox_storage *storage);
+/* Flush all cached input data from opened files. */
+void dbox_files_sync_input(struct dbox_storage *storage);
/* Assign a newly created file a new id. For single files assign UID,
for multi files assign map UID. */
struct mail_index_view_sync_ctx *ctx;
bool delayed_expunges;
+ /* some open files may have read partially written mails. now that
+ map syncing makes the new mails visible, we need to make sure the
+ partial data is flushed out of memory */
+ dbox_files_sync_input(map->storage);
+
if (mail_index_refresh(map->view->index) < 0) {
mail_storage_set_internal_error(&map->storage->storage);
mail_index_reset_error(map->index);