| 1165 | */ |
| 1166 | |
| 1167 | static inline int dr_reload_data_head(struct head_db *hd, |
| 1168 | str *part_name, int initial, |
| 1169 | const int is_inherit_state) |
| 1170 | { |
| 1171 | db_con_t* db_hdl = *hd->db_con; |
| 1172 | db_func_t *dr_dbf = &hd->db_funcs; |
| 1173 | rt_data_t *new_data; |
| 1174 | rt_data_t *old_data; |
| 1175 | pgw_t *gw, *old_gw; |
| 1176 | pcr_t *cr, *old_cr; |
| 1177 | time_t rawtime; |
| 1178 | struct dr_prepare_part_params pp; |
| 1179 | int ret = -1; |
| 1180 | MD5_CTX Md5Ctx, *ctxp=NULL; |
| 1181 | HASH bin_md5; |
| 1182 | char hash_report_data[64]; |
| 1183 | |
| 1184 | void **dest; |
| 1185 | map_iterator_t it; |
| 1186 | |
| 1187 | db_res_t* res = NULL; |
| 1188 | db_row_t *row = NULL; |
| 1189 | str *rules_tables=NULL; |
| 1190 | int rules_no,i; |
| 1191 | char *p; |
| 1192 | str rule_table_query; |
| 1193 | |
| 1194 | if (no_concurrent_reload) { |
| 1195 | lock_get( hd->ref_lock->lock ); |
| 1196 | if (hd->ongoing_reload) { |
| 1197 | lock_release( hd->ref_lock->lock ); |
| 1198 | LM_WARN("Reload already in progress, discarding this one\n"); |
| 1199 | return -2; |
| 1200 | } |
| 1201 | hd->ongoing_reload = 1; |
| 1202 | lock_release( hd->ref_lock->lock ); |
| 1203 | } |
| 1204 | |
| 1205 | if (initial && hd->cache && hd->cache->rdata) { |
| 1206 | LM_INFO("starting drouting with cache data %p->%p!\n", hd->cache, hd->cache->rdata); |
| 1207 | dr_update_head_cache(hd); |
| 1208 | goto success; |
| 1209 | } |
| 1210 | |
| 1211 | pp.part_name = *part_name; |
| 1212 | run_dr_cbs(DRCB_RLD_PREPARE_PART, &pp); |
| 1213 | |
| 1214 | LM_INFO("loading drouting data!\n"); |
| 1215 | |
| 1216 | if (initial) |
| 1217 | sr_set_status( dr_srg, STR2CI(hd->partition), SR_STATUS_LOADING_DATA, |
| 1218 | CHAR_INT("startup data loading"), 0); |
| 1219 | else |
| 1220 | sr_set_status( dr_srg, STR2CI(hd->partition), SR_STATUS_RELOADING_DATA, |
| 1221 | CHAR_INT("data re-loading"), 0); |
| 1222 | |
| 1223 | if (!uses_rule_table_query(hd, &rule_table_query)) { |
| 1224 |
no test coverage detected