diff options
Diffstat (limited to 'src/can-bus.cpp')
-rw-r--r-- | src/can-bus.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/can-bus.cpp b/src/can-bus.cpp index 989dfa20..52c81cf1 100644 --- a/src/can-bus.cpp +++ b/src/can-bus.cpp @@ -143,8 +143,6 @@ void can_bus_t::stop_threads() { is_decoding_ = false; is_pushing_ = false; - th_decoding_.join(); - th_pushing_.join(); } int can_bus_t::init_can_dev() @@ -361,7 +359,7 @@ canfd_frame can_bus_dev_t::read() { ssize_t nbytes; //int maxdlen; - canfd_frame canfd_frame; + struct canfd_frame cfd; /* Test that socket is really opened */ if (can_socket_ < 0) @@ -370,17 +368,18 @@ canfd_frame can_bus_dev_t::read() is_running_ = false; } - nbytes = ::read(can_socket_, &canfd_frame, CANFD_MTU); + nbytes = ::read(can_socket_, &cfd, CANFD_MTU); /* if we did not fit into CAN sized messages then stop_reading. */ if (nbytes != CANFD_MTU && nbytes != CAN_MTU) + { if (errno == ENETDOWN) ERROR(binder_interface, "read: %s CAN device down", device_name_); - ERROR(binder_interface, "read: Error reading CAN bus"); - ::memset(&canfd_frame, 0, sizeof(canfd_frame)); - stop_reading(); + ERROR(binder_interface, "read: Incomplete CAN(FD) frame"); + ::memset(&cfd, 0, sizeof(cfd)); + } - return canfd_frame; + return cfd; } void can_bus_dev_t::start_reading(can_bus_t& can_bus) @@ -395,7 +394,6 @@ void can_bus_dev_t::start_reading(can_bus_t& can_bus) void can_bus_dev_t::stop_reading() { is_running_ = false; - th_reading_.join(); } void can_bus_dev_t::can_reader(can_bus_t& can_bus) |