2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (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://www.tizenopensource.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.
27 #include "slave_life.h"
28 #include "client_life.h"
30 #include "fault_manager.h"
36 static int evt_cb(int handle, void *data)
38 struct slave_node *slave;
39 struct client_node *client;
40 struct liveinfo *liveinfo;
42 slave = slave_find_by_rpc_handle(handle);
44 DbgPrint("Slave is disconnected %d\n", handle);
45 if (slave_pid(slave) != (pid_t)-1) {
46 if (slave_state(slave) == SLAVE_REQUEST_TO_TERMINATE)
47 slave = slave_deactivated(slave);
48 else if (slave_state(slave) != SLAVE_TERMINATED)
49 slave = slave_deactivated_by_fault(slave);
52 DbgPrint("Slave pointer: %p (0x0 means deleted)\n", slave);
56 client = client_find_by_rpc_handle(handle);
58 DbgPrint("Client is disconnected\n");
59 if (client_pid(client) != (pid_t)-1)
60 client_deactivated_by_fault(client);
65 liveinfo = liveinfo_find_by_handle(handle);
67 DbgPrint("Utility is disconnected\n");
68 liveinfo_destroy(liveinfo);
72 DbgPrint("This is not my favor: %d\n", handle);
76 HAPI int dead_init(void)
78 com_core_add_event_callback(CONNECTOR_DISCONNECTED, evt_cb, NULL);
79 // aul_listen_app_dead_signal(dead_cb, NULL);
83 HAPI int dead_fini(void)
85 com_core_del_event_callback(CONNECTOR_DISCONNECTED, evt_cb, NULL);