| 357 | } |
| 358 | |
| 359 | static void wd_key_changed( |
| 360 | int32_t event, |
| 361 | const char *key_name, |
| 362 | struct icmap_notify_value new_val, |
| 363 | struct icmap_notify_value old_val, |
| 364 | void *user_data) |
| 365 | { |
| 366 | struct resource* ref = (struct resource*)user_data; |
| 367 | char *last_key_part; |
| 368 | |
| 369 | if (ref == NULL) { |
| 370 | return ; |
| 371 | } |
| 372 | |
| 373 | last_key_part = strrchr(key_name, '.'); |
| 374 | if (last_key_part == NULL) { |
| 375 | return ; |
| 376 | } |
| 377 | last_key_part++; |
| 378 | |
| 379 | if (event == ICMAP_TRACK_ADD || event == ICMAP_TRACK_MODIFY) { |
| 380 | if (strcmp(last_key_part, "last_updated") == 0 || |
| 381 | strcmp(last_key_part, "current") == 0) { |
| 382 | return; |
| 383 | } |
| 384 | |
| 385 | cs_fsm_process(&ref->fsm, WD_E_CONFIG_CHANGED, ref, wd_fsm_cb); |
| 386 | } |
| 387 | |
| 388 | if (event == ICMAP_TRACK_DELETE && ref != NULL) { |
| 389 | if (strcmp(last_key_part, "state") != 0) { |
| 390 | return ; |
| 391 | } |
| 392 | |
| 393 | log_printf (LOGSYS_LEVEL_WARNING, |
| 394 | "resource \"%s\" deleted from cmap!", |
| 395 | ref->name); |
| 396 | |
| 397 | api->timer_delete(ref->check_timer); |
| 398 | ref->check_timer = 0; |
| 399 | icmap_track_delete(ref->icmap_track); |
| 400 | |
| 401 | free(ref); |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | static void wd_resource_check_fn (void* resource_ref) |
| 406 | { |
nothing calls this directly
no test coverage detected