mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
Don't update the database author if we already know it
This commit is contained in:
parent
acaedd644c
commit
e98592a7c1
2
meshms.c
2
meshms.c
@ -306,6 +306,8 @@ static int append_meshms_buffer(const sid_t *my_sid, struct conversations *conv,
|
||||
if (conv->found_my_ply){
|
||||
if (rhizome_retrieve_manifest(conv->my_ply.bundle_id, m))
|
||||
goto end;
|
||||
// set the author of the manifest as we should already know that
|
||||
bcopy(my_sid->binary, m->author, sizeof(m->author));
|
||||
if (rhizome_find_bundle_author(m))
|
||||
goto end;
|
||||
}else{
|
||||
|
@ -365,16 +365,19 @@ int rhizome_find_bundle_author(rhizome_manifest *m)
|
||||
|
||||
if (!rhizome_bk2secret(m,m->cryptoSignPublic,rs,rs_len,
|
||||
bkBytes,m->cryptoSignSecret)) {
|
||||
memcpy(m->author, authorSid, sizeof m->author);
|
||||
m->haveSecret=EXISTING_BUNDLE_ID;
|
||||
if (config.debug.rhizome)
|
||||
DEBUGF("found bundle author sid=%s", alloca_tohex_sid(m->author));
|
||||
|
||||
// if this bundle is already in the database, update the author.
|
||||
if (m->inserttime){
|
||||
const char *id = rhizome_manifest_get(m, "id", NULL, 0);
|
||||
if (sqlite_exec_void("UPDATE MANIFESTS SET author='%s' WHERE id='%s';", alloca_tohex_sid(m->author), id) == -1)
|
||||
WARN("Error updating MANIFESTS author column");
|
||||
if (memcmp(m->author, authorSid, sizeof m->author)){
|
||||
memcpy(m->author, authorSid, sizeof m->author);
|
||||
if (config.debug.rhizome)
|
||||
DEBUGF("found bundle author sid=%s", alloca_tohex_sid(m->author));
|
||||
|
||||
// if this bundle is already in the database, update the author.
|
||||
if (m->inserttime){
|
||||
const char *id = rhizome_manifest_get(m, "id", NULL, 0);
|
||||
if (sqlite_exec_void("UPDATE MANIFESTS SET author='%s' WHERE id='%s';", alloca_tohex_sid(m->author), id) == -1)
|
||||
WARN("Error updating MANIFESTS author column");
|
||||
}
|
||||
}
|
||||
|
||||
RETURN(0); // bingo
|
||||
|
Loading…
x
Reference in New Issue
Block a user