aboutsummaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/can
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-09 16:48:49 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-10 18:45:55 +0200
commita261e68d0dd32a03fdf42522e6d2c8259ba0f3d1 (patch)
tree407534d0acada5fa68271e8b65973d4f048db7b2 /CAN-binder/low-can-binding/can
parent863526d4ab28091148a0466769b443624911006b (diff)
Fix: Avoid returning negative value that's stop watch socket
Even if the frame read is wrong doesn't mean that socket is compromise only that communication on CAN bus is difficult, maybe temporary. On en EPOLL err code, or hangup, just close and restart the socket and reset the filter. Change-Id: I61f146fd269bb2524f09e1f2ed89d93e83166136 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/can')
-rw-r--r--CAN-binder/low-can-binding/can/can-signals.cpp4
-rw-r--r--CAN-binder/low-can-binding/can/can-signals.hpp2
2 files changed, 2 insertions, 4 deletions
diff --git a/CAN-binder/low-can-binding/can/can-signals.cpp b/CAN-binder/low-can-binding/can/can-signals.cpp
index c8098a51..d072fb36 100644
--- a/CAN-binder/low-can-binding/can/can-signals.cpp
+++ b/CAN-binder/low-can-binding/can/can-signals.cpp
@@ -235,7 +235,7 @@ int can_signal_t::create_rx_filter()
return -1;
}
-can_message_format_t can_signal_t::read_socket()
+void can_signal_t::read_socket()
{
can_message_t msg;
can_bus_t& cbm = configuration_t::instance().get_can_bus_manager();
@@ -243,6 +243,4 @@ can_message_format_t can_signal_t::read_socket()
std::lock_guard<std::mutex> can_message_lock(cbm.get_can_message_mutex());
{ cbm.push_new_can_message(msg); }
cbm.get_new_can_message_cv().notify_one();
-
- return msg.get_format();
} \ No newline at end of file
diff --git a/CAN-binder/low-can-binding/can/can-signals.hpp b/CAN-binder/low-can-binding/can/can-signals.hpp
index 8196c7eb..6152b79a 100644
--- a/CAN-binder/low-can-binding/can/can-signals.hpp
+++ b/CAN-binder/low-can-binding/can/can-signals.hpp
@@ -159,5 +159,5 @@ public:
void set_last_value(float val);
int create_rx_filter();
- can_message_format_t read_socket();
+ void read_socket();
}; \ No newline at end of file