static int unload_observer_delete(void *obj, void *arg, int flags) { struct contact_expiration *expiration = obj; AST_SCHED_DEL_UNREF(sched, expiration->sched, ao2_cleanup(expiration)); return CMP_MATCH; }
/*! * \internal * \brief Unschedule all existing contacts */ static int unschedule_all_cb(void *obj, void *arg, int flags) { struct sched_data *data = obj; AST_SCHED_DEL_UNREF(sched, data->id, ao2_ref(data, -1)); return CMP_MATCH; }
/*! * \internal * \brief Remove the contact from the scheduler. */ static void unschedule_qualify(struct ast_sip_contact *contact) { struct sched_data *data; data = ao2_find(sched_qualifies, contact, OBJ_UNLINK | OBJ_SEARCH_KEY); if (!data) { return; } AST_SCHED_DEL_UNREF(sched, data->id, ao2_t_ref(data, -1, "Delete scheduler entry ref")); ao2_t_ref(data, -1, "Done with ao2_find ref"); }
/*! \brief Observer callback for when a contact is deleted */ static void contact_expiration_observer_deleted(const void *object) { struct contact_expiration *expiration; expiration = ao2_find(contact_autoexpire, ast_sorcery_object_get_id(object), OBJ_SEARCH_KEY | OBJ_UNLINK); if (!expiration) { return; } AST_SCHED_DEL_UNREF(sched, expiration->sched, ao2_cleanup(expiration)); ao2_ref(expiration, -1); }
int ast_dns_resolve_recurring_cancel(struct ast_dns_query_recurring *recurring) { int res = 0; ao2_lock(recurring); recurring->cancelled = 1; AST_SCHED_DEL_UNREF(ast_dns_get_sched(), recurring->timer, ao2_ref(recurring, -1)); if (recurring->active) { res = ast_dns_resolve_cancel(recurring->active); ao2_replace(recurring->active, NULL); } ao2_unlock(recurring); return res; }
/*! * \internal * \brief Set up a scheduled qualify contact check. */ static void schedule_qualify(struct ast_sip_contact *contact, int initial_interval) { struct sched_data *data; data = sched_data_create(contact); if (!data) { return; } ast_assert(contact->qualify_frequency != 0); ao2_t_ref(data, +1, "Ref for qualify_contact_sched() scheduler entry"); data->id = ast_sched_add_variable(sched, initial_interval, qualify_contact_sched, data, 1); if (data->id < 0) { ao2_t_ref(data, -1, "Cleanup failed scheduler add"); ast_log(LOG_ERROR, "Unable to schedule qualify for contact %s\n", contact->uri); } else if (!ao2_link(sched_qualifies, data)) { AST_SCHED_DEL_UNREF(sched, data->id, ao2_t_ref(data, -1, "Cleanup scheduler for failed ao2_link")); } ao2_t_ref(data, -1, "Done setting up scheduler entry"); }