mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-04-14 22:26:44 +00:00
Don't fail to write a message ply, if the payload is already stored
This commit is contained in:
parent
d1a1a41f08
commit
8ad03cb427
8
meshmb.c
8
meshmb.c
@ -469,12 +469,12 @@ int meshmb_flush(struct meshmb_feeds *feeds)
|
||||
|
||||
rhizome_manifest_set_filehash(m, &write.id);
|
||||
rhizome_manifest_set_filesize(m, write.file_length);
|
||||
struct rhizome_bundle_result result = rhizome_manifest_finalise(m, &mout, 1);
|
||||
if (result.status == RHIZOME_BUNDLE_STATUS_NEW){
|
||||
struct rhizome_bundle_result end_result = rhizome_manifest_finalise(m, &mout, 1);
|
||||
if (end_result.status == RHIZOME_BUNDLE_STATUS_NEW){
|
||||
ret = ++feeds->generation;
|
||||
feeds->dirty = 0;
|
||||
}
|
||||
rhizome_bundle_result_free(&result);
|
||||
rhizome_bundle_result_free(&end_result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -483,9 +483,11 @@ int meshmb_flush(struct meshmb_feeds *feeds)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
WHYF("Unexpected bundle status: %s", rhizome_bundle_result_message(result));
|
||||
break;
|
||||
}
|
||||
|
||||
rhizome_bundle_result_free(&result);
|
||||
rhizome_manifest_free(m);
|
||||
return ret;
|
||||
}
|
||||
|
@ -126,12 +126,15 @@ int message_ply_write_finish(struct message_ply_write *ply_write, struct message
|
||||
{
|
||||
enum rhizome_payload_status status = rhizome_finish_write(&ply_write->write);
|
||||
status = rhizome_finish_store(&ply_write->write, ply_write->m, status);
|
||||
if (status != RHIZOME_PAYLOAD_STATUS_NEW)
|
||||
// There's a chance that the new payload will actually be identical to one that already exists
|
||||
if (status != RHIZOME_PAYLOAD_STATUS_NEW && status != RHIZOME_PAYLOAD_STATUS_STORED){
|
||||
WHYF("Failed to write payload: %s", rhizome_payload_status_message(status));
|
||||
return -1;
|
||||
}
|
||||
rhizome_manifest *mout = NULL;
|
||||
struct rhizome_bundle_result result = rhizome_manifest_finalise(ply_write->m, &mout, 1);
|
||||
if (result.status != RHIZOME_BUNDLE_STATUS_NEW){
|
||||
WARNF("Cannot create message ply manifest: %s", alloca_rhizome_bundle_result(result));
|
||||
WHYF("Cannot create message ply manifest: %s", alloca_rhizome_bundle_result(result));
|
||||
rhizome_bundle_result_free(&result);
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user