Return PAYLOAD_STATUS_NEW if file is now missing from the store

This commit is contained in:
Jeremy Lakeman 2016-09-05 15:13:09 +09:30
parent 7beab7e5d8
commit 05da181541

View File

@ -1038,9 +1038,12 @@ enum rhizome_payload_status rhizome_open_read(struct rhizome_read *read, const r
read->offset = 0;
read->hash_offset = 0;
if (sqlite_exec_uint64(&read->length,"SELECT length FROM FILES WHERE id = ?",
RHIZOME_FILEHASH_T, &read->id, END) == -1)
int r = sqlite_exec_uint64(&read->length,"SELECT length FROM FILES WHERE id = ?",
RHIZOME_FILEHASH_T, &read->id, END);
if (r == -1)
return RHIZOME_PAYLOAD_STATUS_ERROR;
if (r == 0)
return RHIZOME_PAYLOAD_STATUS_NEW;
assert(read->length>0);
if (sqlite_exec_uint64(&read->blob_rowid,