| 627 | } |
| 628 | |
| 629 | bool cbm_daemon_job_unsubscribe(cbm_daemon_coordinator_t *coordinator, |
| 630 | cbm_daemon_client_id_t client_id, |
| 631 | cbm_daemon_subscription_id_t subscription_id) { |
| 632 | if (!coordinator || client_id == CBM_DAEMON_CLIENT_ID_INVALID || |
| 633 | subscription_id == CBM_DAEMON_SUBSCRIPTION_ID_INVALID) { |
| 634 | return false; |
| 635 | } |
| 636 | |
| 637 | cbm_daemon_callback_batch_t batch; |
| 638 | cbm_mutex_lock(&coordinator->mutex); |
| 639 | callback_batch_init_locked(coordinator, &batch); |
| 640 | if (!find_client_locked(coordinator, client_id)) { |
| 641 | cbm_mutex_unlock(&coordinator->mutex); |
| 642 | return false; |
| 643 | } |
| 644 | bool removed = false; |
| 645 | for (cbm_daemon_job_t *job = coordinator->jobs; job; job = job->next) { |
| 646 | removed = remove_subscription_locked(&job->subscriptions, &job->subscription_count, |
| 647 | client_id, subscription_id); |
| 648 | if (removed) { |
| 649 | request_job_cancel_locked(coordinator, job, &batch); |
| 650 | break; |
| 651 | } |
| 652 | } |
| 653 | cbm_mutex_unlock(&coordinator->mutex); |
| 654 | callback_batch_run(coordinator, &batch); |
| 655 | return removed; |
| 656 | } |
| 657 | |
| 658 | bool cbm_daemon_watch_unsubscribe(cbm_daemon_coordinator_t *coordinator, |
| 659 | cbm_daemon_client_id_t client_id, |
no test coverage detected