m_handler = new(std::nothrow) listener_handler(this);
if (!m_handler) {
+ _E("Failed to allocate memory");
delete m_client;
return false;
}
stop();
disconnect();
+ unset_event_handler();
+ unset_accuracy_handler();
+ unset_attribute_int_changed_handler();
+ unset_attribute_str_changed_handler();
+
m_handler->disconnect();
m_loop->add_channel_handler_release_list(m_handler);
m_handler = NULL;
delete m_client;
m_client = NULL;
- unset_event_handler();
- unset_accuracy_handler();
- unset_attribute_int_changed_handler();
- unset_attribute_str_changed_handler();
-
m_attributes_int.clear();
m_attributes_str.clear();
_D("Deinitialized..");
{
ipc::message msg;
ipc::message reply;
- cmd_listener_start_t buf;
+ cmd_listener_start_t buf = {0, };
retvm_if(!m_cmd_channel, -EINVAL, "Failed to connect to server");
{
ipc::message msg;
ipc::message reply;
- cmd_listener_stop_t buf;
+ cmd_listener_stop_t buf = {0, };
retvm_if(!m_cmd_channel, -EINVAL, "Failed to connect to server");
retvm_if(!m_started.load(), -EAGAIN, "Already stopped");
{
ipc::message msg;
ipc::message reply;
- cmd_listener_attr_int_t buf;
+ cmd_listener_attr_int_t buf = {0, };
retvm_if(!m_cmd_channel, -EIO, "Failed to connect to server");
{
ipc::message msg;
ipc::message reply;
- cmd_listener_attr_int_t buf;
+ cmd_listener_attr_int_t buf = {0, };
retvm_if(!m_cmd_channel, -EIO, "Failed to connect to server");
{
ipc::message msg;
ipc::message reply;
- cmd_listener_attr_str_t buf;
+ cmd_listener_attr_str_t buf = {0, };
buf.listener_id = m_id;
buf.attribute = attribute;
{
ipc::message msg;
ipc::message reply;
- cmd_listener_get_data_t buf;
+ cmd_listener_get_data_t buf = {0, };
retvm_if(!m_cmd_channel, -EIO, "Failed to connect to server");
{
ipc::message msg;
ipc::message reply;
- cmd_listener_get_data_list_t buf;
+ cmd_listener_get_data_list_t buf = {0, };
retvm_if(!m_cmd_channel, -EIO, "Failed to connect to server");
uint64_t channel::bind(void)
{
retv_if(!m_loop, 0);
+ channel_event_handler* handler = dynamic_cast<channel_event_handler *>(m_handler);
+
+ if (!handler) {
+ _E("Failed to bind channel[%p] : handler[%p]", this, m_handler);
+ m_event_id = 0;
+ return 0;
+ }
m_event_id = m_loop->add_event(m_socket->get_fd(),
- (EVENT_IN | EVENT_HUP | EVENT_NVAL),
- dynamic_cast<channel_event_handler *>(m_handler));
+ (EVENT_IN | EVENT_HUP | EVENT_NVAL), handler);
_D("Bind channel[%p] : handler[%p] event_id[%llu]", this, m_handler, m_event_id);
return m_event_id;