Changes in extensions/rt_default/rtd_rules.c [1336:cec0812038bb:1179:f5e9b53d6f86] in freeDiameter
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rt_default/rtd_rules.c
r1336 r1179 47 47 * Under each TARGET element, we have the list of RULES that are defined for this target, ordered by CRITERIA type, then is_regex, then string value. 48 48 * 49 * Note: Access these only when holding rtd_lock; config reload may change the underlying data.49 * Note: Except during configuration parsing and module termination, the lists are only ever accessed read-only, so we do not need a lock. 50 50 */ 51 51 … … 390 390 } 391 391 392 static void free_targets(void) 392 /* Destroy the module's data */ 393 void rtd_fini(void) 393 394 { 394 395 int i; 396 397 TRACE_ENTRY(); 395 398 396 399 for (i = 0; i < RTD_TAR_MAX; i++) { … … 399 402 } 400 403 } 401 } 402 403 /* Destroy the module's data */ 404 void rtd_fini(void) 405 { 406 TRACE_ENTRY(); 407 408 free_targets(); 404 409 405 } 410 406 … … 497 493 498 494 return 0; 499 }500 501 void rtd_conf_reload(char *config_file)502 {503 /* save old config in case reload goes wrong */504 struct fd_list old_config[RTD_TAR_MAX];505 int i;506 507 for (i = 0; i < RTD_TAR_MAX; i++) {508 old_config[i] = TARGETS[i];509 }510 memset(TARGETS, 0, sizeof(*TARGETS) * RTD_TAR_MAX);511 for (i = 0; i < RTD_TAR_MAX; i++) {512 fd_list_init(&TARGETS[i], NULL);513 }514 515 if (rtd_conf_handle(config_file) != 0) {516 fd_log_notice("rt_default: error reloading configuration, restoring previous configuration");517 free_targets();518 for (i = 0; i < RTD_TAR_MAX; i++) {519 TARGETS[i] = old_config[i];520 }521 } else {522 /* this has to be done in this weird way because the items contain back pointers referencing TARGETS */523 struct fd_list save_config[RTD_TAR_MAX];524 for (i = 0; i < RTD_TAR_MAX; i++) {525 save_config[i] = TARGETS[i];526 TARGETS[i] = old_config[i];527 }528 free_targets();529 for (i = 0; i < RTD_TAR_MAX; i++) {530 TARGETS[i] = save_config[i];531 }532 }533 495 } 534 496
Note: See TracChangeset
for help on using the changeset viewer.