95
* service exit and unlink schedwrk handler data structure
97
struct seus_handler_data {
98
hdb_handle_t service_handle;
100
struct corosync_api_v1 *api;
92
103
struct corosync_service_engine *ais_service[SERVICE_HANDLER_MAXIMUM_COUNT];
94
105
hdb_handle_t service_stats_handle[SERVICE_HANDLER_MAXIMUM_COUNT][64];
107
int ais_service_exiting[SERVICE_HANDLER_MAXIMUM_COUNT];
96
109
static hdb_handle_t object_internal_configuration_handle;
98
111
static hdb_handle_t object_stats_services_handle;
100
113
static void (*service_unlink_all_complete) (void) = NULL;
102
static hdb_handle_t unlink_all_handle;
115
static hdb_handle_t swrk_service_exit_handle;
116
static hdb_handle_t swrk_service_unlink_handle;
105
118
static unsigned int default_services_requested (struct corosync_api_v1 *corosync_api)
272
285
struct corosync_api_v1 *corosync_api,
273
286
int lowest_priority,
274
287
int *current_priority,
275
int *current_service_engine)
288
int *current_service_engine,
289
hdb_handle_t *current_service_handle)
277
291
unsigned short *service_id;
278
292
hdb_handle_t object_service_handle;
322
log_printf(LOGSYS_LEVEL_NOTICE,
323
"Service engine unloaded: %s\n",
324
ais_service[*current_service_engine]->name);
326
ais_service[*current_service_engine] = NULL;
328
337
res = corosync_api->object_key_get (
329
338
object_service_handle,
331
340
(void *)&found_service_handle,
334
lcr_ifact_release (*found_service_handle);
336
corosync_api->object_destroy (object_service_handle);
343
*current_service_handle = *found_service_handle;
345
ais_service_exiting[*current_service_engine] = 1;
347
corosync_api->object_find_destroy (object_find_handle);
350
* Call should call this function again
341
356
corosync_api->object_find_destroy (object_find_handle);
360
* We finish unlink of all services -> no need to call this function again
347
365
static unsigned int service_unlink_and_exit (
541
static int unlink_all_schedwrk_handler (const void *data) {
560
* Declaration of exit_schedwrk_handler, because of cycle
561
* (service_exit_schedwrk_handler calls service_unlink_schedwrk_handler, and vice-versa)
563
static int service_exit_schedwrk_handler (const void *data);
565
static int service_unlink_schedwrk_handler (const void *data) {
566
struct seus_handler_data *cb_data = (struct seus_handler_data *)data;
567
struct corosync_api_v1 *api = (struct corosync_api_v1 *)cb_data->api;
570
* Exit all ipc connections dependent on this service
572
if (coroipcs_ipc_service_exit (cb_data->service_engine) == -1)
575
log_printf(LOGSYS_LEVEL_NOTICE,
576
"Service engine unloaded: %s\n",
577
ais_service[cb_data->service_engine]->name);
579
ais_service[cb_data->service_engine] = NULL;
581
lcr_ifact_release (cb_data->service_handle);
583
api->schedwrk_create (
584
&swrk_service_exit_handle,
585
&service_exit_schedwrk_handler,
591
static int service_exit_schedwrk_handler (const void *data) {
543
593
static int current_priority = 0;
544
594
static int current_service_engine = 0;
545
595
static int called = 0;
546
struct corosync_api_v1 *api = (struct corosync_api_v1 *)data;
596
struct seus_handler_data *cb_data = (struct seus_handler_data *)data;
597
struct corosync_api_v1 *api = (struct corosync_api_v1 *)cb_data->api;
598
hdb_handle_t service_handle;
548
600
if (called == 0) {
549
601
log_printf(LOGSYS_LEVEL_NOTICE,
558
610
¤t_priority,
559
¤t_service_engine);
611
¤t_service_engine,
561
614
service_unlink_all_complete();
619
cb_data->service_engine = current_service_engine;
620
cb_data->service_handle = service_handle;
622
api->schedwrk_create_nolock (
623
&swrk_service_unlink_handle,
624
&service_unlink_schedwrk_handler,
579
647
if (called == 0) {
583
653
api->schedwrk_create (
585
&unlink_all_schedwrk_handler,
654
&swrk_service_exit_handle,
655
&service_exit_schedwrk_handler,
589
659
struct service_unlink_and_exit_data {