2 * Copyright 2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
26 #include <dynamicbox_service.h> /* destroy_type for instance.h */
28 #include "slave_life.h"
29 #include "client_life.h"
31 #include "fault_manager.h"
37 static int evt_cb(int handle, void *data)
39 struct slave_node *slave;
40 struct client_node *client;
41 struct liveinfo *liveinfo;
43 slave = slave_find_by_rpc_handle(handle);
45 if (slave_pid(slave) != (pid_t)-1) {
46 switch (slave_state(slave)) {
47 case SLAVE_REQUEST_TO_DISCONNECT:
48 DbgPrint("Disconnected from %d\n", slave_pid(slave));
49 case SLAVE_REQUEST_TO_TERMINATE:
50 slave = slave_deactivated(slave);
53 slave = slave_deactivated_by_fault(slave);
59 DbgPrint("Slave is deleted\n");
65 client = client_find_by_rpc_handle(handle);
67 if (client_pid(client) != (pid_t)-1) {
68 client = client_deactivated_by_fault(client);
72 DbgPrint("Client is deleted\n");
78 liveinfo = liveinfo_find_by_handle(handle);
80 liveinfo_destroy(liveinfo);
87 HAPI int dead_init(void)
89 com_core_add_event_callback(CONNECTOR_DISCONNECTED, evt_cb, NULL);
93 HAPI int dead_fini(void)
95 com_core_del_event_callback(CONNECTOR_DISCONNECTED, evt_cb, NULL);