Check atomic DM enqueue rollback and explain sequence conflicts
This commit is contained in:
1 parent
c2e1fed6d5
commit
3d2fd22ba5
2 files changed
+20
-2
No files matched your search
+7
-2
@@ -393,8 +393,13 @@ static int dm_store_message(struct dm_state* dm, const char* conv, int dir, cons
|
||||
sqlite3_bind_int(st, 2, dir);
|
||||
sqlite3_bind_int64(st, 3, (sqlite3_int64)seq);
|
||||
rc = sqlite3_step(st);
|
||||
if (rc != SQLITE_ROW || sqlite3_column_bytes(st, 0) != DM_MSG_SIG_SIZE ||
|
||||
memcmp(sqlite3_column_blob(st, 0), msg + len - DM_MSG_SIG_SIZE, DM_MSG_SIG_SIZE)) goto fail;
|
||||
if (rc != SQLITE_ROW || sqlite3_column_bytes(st, 0) != DM_MSG_SIG_SIZE) goto fail;
|
||||
if (memcmp(sqlite3_column_blob(st, 0), msg + len - DM_MSG_SIG_SIZE, DM_MSG_SIG_SIZE)) {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_DM, "%s: conflicting body for saved message conv=%s dir=%d seq=%llu", DM_ID,
|
||||
conv, dir, (unsigned long long)seq);
|
||||
sqlite3_finalize(st);
|
||||
return -1;
|
||||
}
|
||||
sqlite3_finalize(st);
|
||||
return 0;
|
||||
fail:
|
||||
|
||||
Reference in new issue
Block a user