From: kibak.yoon Date: Tue, 22 Mar 2016 14:08:12 +0000 (+0900) Subject: sensord: check whether the data is valid or not X-Git-Tag: accepted/tizen/common/20160406.143452~1^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F12%2F64512%2F1;p=platform%2Fcore%2Fsystem%2Fsensord.git sensord: check whether the data is valid or not Change-Id: Ia456be16c90f949b1d32bbdc53579b41d58a477d Signed-off-by: kibak.yoon --- diff --git a/src/server/command_worker.cpp b/src/server/command_worker.cpp index b10071f..83e5bce 100644 --- a/src/server/command_worker.cpp +++ b/src/server/command_worker.cpp @@ -712,6 +712,9 @@ bool command_worker::cmd_get_data(void *payload) remain_count = m_module->get_data(&data, &length); + if (remain_count < 0) + state = OP_ERROR; + // In case of not getting sensor data, wait short time and retry again // 1. changing interval to be less than 10ms // 2. In case of first time, wait for INIT_WAIT_TIME diff --git a/src/server/sensor_event_poller.cpp b/src/server/sensor_event_poller.cpp index 6058eed..082d689 100644 --- a/src/server/sensor_event_poller.cpp +++ b/src/server/sensor_event_poller.cpp @@ -51,6 +51,9 @@ void sensor_event_poller::init_sensor_map() fd = sensor->get_poll_fd(); + if (fd < 0) + continue; + m_fd_sensors.insert(std::make_pair(fd, sensor)); } }