]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_sorcery_realtime: fix bug when successful UPDATE is treated as failed 46/3146/2
authorAlexei Gradinari <alex2grad@gmail.com>
Mon, 4 Jul 2016 21:38:57 +0000 (17:38 -0400)
committerAlexei Gradinari <alex2grad@gmail.com>
Thu, 7 Jul 2016 14:02:45 +0000 (10:02 -0400)
commitb4a9fa2c9e2c7c5bae5b6bbb4a6fb7f021a1f2f6
tree587384a76c2d91f928937cf4bc129bb64a8495c2
parentac6824e4c32c49b8943fca85b318892ab4bb8df3
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
res/res_config_odbc.c
res/res_sorcery_realtime.c
tests/test_sorcery_realtime.c