Skip to content

Commit

Permalink
[pua] properly insert sh_tag into pua table
Browse files Browse the repository at this point in the history
Credits go to @NormB
Fixes #3377

(cherry picked from commit 92b0dcf)
  • Loading branch information
bogdan-iancu committed Apr 30, 2024
1 parent 9a503f3 commit f019ddc
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions modules/pua/pua.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,16 +874,17 @@ int update_pua(ua_pres_t* p, unsigned int hash_code, unsigned int final)
static void db_update(unsigned int ticks,void *param)
{
ua_pres_t* p= NULL;
db_key_t q_cols[19];
db_val_t q_vals[19];
db_key_t q_cols[20];
db_val_t q_vals[20];
db_key_t db_cols[5];
db_val_t db_vals[5];
db_op_t db_ops[1] ;
int n_query_cols= 0, n_query_update= 0;
int n_update_cols= 0;
int i;
int puri_col,touri_col,pid_col,expires_col,flag_col,etag_col,tuple_col,event_col;
int watcher_col,callid_col,totag_col,fromtag_col,record_route_col,cseq_col;
int puri_col,touri_col,pid_col,expires_col,flag_col,etag_col,tuple_col;
int event_col, watcher_col, callid_col, totag_col, fromtag_col;
int record_route_col, cseq_col, shtag_col;
int no_lock= 0, contact_col, desired_expires_col, extra_headers_col;
int remote_contact_col, version_col;

Expand Down Expand Up @@ -981,6 +982,11 @@ static void db_update(unsigned int ticks,void *param)
q_vals[touri_col].nul = 0;
n_query_cols++;

q_cols[shtag_col= n_query_cols] = &str_sh_tag_col;
q_vals[shtag_col].type = DB_STR;
q_vals[shtag_col].nul = 0;
n_query_cols++;

/* must keep this the last column to be inserted */
q_cols[extra_headers_col= n_query_cols] = &str_extra_headers_col;
q_vals[extra_headers_col].type = DB_STR;
Expand Down Expand Up @@ -1121,6 +1127,10 @@ static void db_update(unsigned int ticks,void *param)
q_vals[record_route_col].val.str_val = p->record_route;
q_vals[contact_col].val.str_val = p->contact;
q_vals[remote_contact_col].val.str_val = p->remote_contact;
if (is_pua_cluster_enabled() && p->sh_tag.len)
q_vals[shtag_col].val.str_val = p->sh_tag;
else
q_vals[shtag_col].nul = 1;
q_vals[extra_headers_col].val.str_val = p->extra_headers;

if(pua_dbf.insert(pua_db, q_cols, q_vals, n_query_cols)< 0)
Expand Down

0 comments on commit f019ddc

Please sign in to comment.