Skip to content

Commit

Permalink
Fix error handling in DB writes.
Browse files Browse the repository at this point in the history
If inserting/updating a dlg record in DB fails, do not exit with error, but continue with the rest of the dialogs.
Credits for finding and reporting this go to Rik Broers @ Motto
  • Loading branch information
bogdan-iancu committed Jun 3, 2016
1 parent ef10952 commit 0ca6cf0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions modules/dialog/dlg_db_handler.c
Expand Up @@ -1388,7 +1388,7 @@ void dialog_update_db(unsigned int ticks, void * param)
if((dialog_dbf.insert(dialog_db_handle, insert_keys,
values, DIALOG_TABLE_TOTAL_COL_NO)) !=0){
LM_ERR("could not add another dialog to db\n");
goto error;
continue;
}

if (ins_done==0)
Expand Down Expand Up @@ -1429,7 +1429,7 @@ void dialog_update_db(unsigned int ticks, void * param)
if((dialog_dbf.update(dialog_db_handle, (insert_keys), 0,
(values), (insert_keys+15), (values+15), 1, 11)) !=0) {
LM_ERR("could not update database info\n");
goto error;
continue;
}

/* dialog saved */
Expand All @@ -1448,7 +1448,7 @@ void dialog_update_db(unsigned int ticks, void * param)
if((dialog_dbf.update(dialog_db_handle, (insert_keys), 0,
(values), (insert_keys+21), (values+21), 1, 4)) !=0) {
LM_ERR("could not update database info\n");
goto error;
continue;
}

run_dlg_callbacks( DLGCB_SAVED, cell, 0, DLG_DIR_NONE, 0);
Expand Down Expand Up @@ -2041,9 +2041,7 @@ static int restore_dlg_db(void)
if((dialog_dbf.insert(dialog_db_handle, insert_keys,
values, DIALOG_TABLE_TOTAL_COL_NO)) !=0){
LM_ERR("could not add another dialog to db\n");

dlg_unlock(d_table, e);
return -1;
continue;
}

if (ins_done == 0)
Expand Down

0 comments on commit 0ca6cf0

Please sign in to comment.