If there is a connection fail, the API should return the proper error.
Change-Id: I39fca464ee86442d060702ca5782650be7ce5614
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
bool sensor_manager::connect_channel(void)
{
+ bool ret;
ipc::message msg;
m_cmd_channel = m_client->connect(NULL);
retvm_if(!m_mon_channel, false, "Failed to connect to server");
msg.set_type(CMD_MANAGER_CONNECT);
- m_mon_channel->send_sync(&msg);
+ ret = m_mon_channel->send_sync(&msg);
+ retvm_if(!ret, false, "Failed to send message");
m_connected.store(true);
channel *ipc_client::connect(channel_handler *handler, event_loop *loop, bool bind)
{
+ bool ret;
socket *sock;
channel *ch;
channel_event_handler *ev_handler;
if (!ev_handler) {
delete ch;
delete sock;
- _E("Faield to allocate memory");
+ _E("Failed to allocate memory");
return NULL;
}
- ch->connect(ev_handler, loop);
+ ret = ch->connect(ev_handler, loop);
+ if (!ret) {
+ delete ev_handler;
+ delete ch;
+ delete sock;
+ _E("Failed to connect server");
+ return NULL;
+ }
if (loop && bind) {
uint64_t id = loop->add_event(sock->get_fd(),