summaryrefslogtreecommitdiff
path: root/res/res_sorcery_realtime.c
diff options
context:
space:
mode:
authorAlexei Gradinari <alex2grad@gmail.com>2016-07-04 17:38:57 -0400
committerAlexei Gradinari <alex2grad@gmail.com>2016-07-07 12:16:14 -0500
commitc832f100d9c019d85eed9219b2577d38c935c7b4 (patch)
treed1ed02f12dbb2975718b27c9a75349798d62f3c7 /res/res_sorcery_realtime.c
parent9e10aa84969b3b6e57dde5a637c47f17f1fd4ef7 (diff)
res_sorcery_realtime: fix bug when successful UPDATE is treated as failed
If the SQL UPDATE statement changes nothing then SQLRowCount returns 0. This value should be treated as success. But the function sorcery_realtime_update treats it as failed. This bug was found using stress tests on PJSIP. If there are 2 consecutive SIP REGISTER requests with the same contact data during 1 second then res_pjsip_registrar adds contact location on 1st request and tries to update contact location on 2nd. The update fails and res_pjsip_registrar even removes correct contact location. The test "object_update_uncreated" was removed from test_sorcery_realtime.c because it's now a valid situation. This patch also adds missing debug of extra SQL parameter. ASTERISK-26172 #close Change-Id: I05a7f3051455336c9dda29efc229decf86071303
Diffstat (limited to 'res/res_sorcery_realtime.c')
-rw-r--r--res/res_sorcery_realtime.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/res/res_sorcery_realtime.c b/res/res_sorcery_realtime.c
index abf2840fb..4023654ab 100644
--- a/res/res_sorcery_realtime.c
+++ b/res/res_sorcery_realtime.c
@@ -271,7 +271,7 @@ static int sorcery_realtime_update(const struct ast_sorcery *sorcery, void *data
return -1;
}
- return (ast_update_realtime_fields(config->family, UUID_FIELD, ast_sorcery_object_get_id(object), fields) <= 0) ? -1 : 0;
+ return (ast_update_realtime_fields(config->family, UUID_FIELD, ast_sorcery_object_get_id(object), fields) < 0) ? -1 : 0;
}
static int sorcery_realtime_delete(const struct ast_sorcery *sorcery, void *data, void *object)