Change way to validate a subscription object
authorRomain Forlot <romain.forlot@iot.bzh>
Fri, 2 Jun 2017 00:02:20 +0000 (02:02 +0200)
committerRomain Forlot <romain.forlot@iot.bzh>
Fri, 2 Jun 2017 00:02:20 +0000 (02:02 +0200)
Better to check validity of 2 differents type of signals
used and checks that its event is valid.

Change-Id: I1435bbe81a43fd80eae049d43b5e37fc8f893074
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
CAN-binder/low-can-binding/binding/low-can-cb.cpp

index 9a0c501..edda209 100644 (file)
@@ -79,7 +79,7 @@ low_can_subscription_t::low_can_subscription_t( low_can_subscription_t&& s)
 
 low_can_subscription_t::operator bool() const
 {
-       return socket_.socket() != INVALID_SOCKET;
+       return ((can_signal_ != nullptr || diagnostic_message_ != nullptr) && afb_event_is_valid(event_));
 }
 
 struct afb_event& low_can_subscription_t::get_event()