From: Karol Latecki Date: Fri, 21 Oct 2016 16:21:38 +0000 (-0400) Subject: tldk: fix possibility of tle_event_active() from DOWN to UP X-Git-Tag: v18.02~27^2 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F26%2F3826%2F4;p=tldk.git tldk: fix possibility of tle_event_active() from DOWN to UP Docstring in tle_event.h for tle_event_active() only describes possibility of activating event from IDLE state. Also re-added previously failing test case. Change-Id: Ib9e19b6b3e64cc2836337b6a86884f312df73858 Signed-off-by: Karol Latecki Signed-off-by: Mohammad Abdul Awal --- diff --git a/lib/libtle_udp/tle_event.h b/lib/libtle_udp/tle_event.h index 1a5c436..9357def 100644 --- a/lib/libtle_udp/tle_event.h +++ b/lib/libtle_udp/tle_event.h @@ -168,7 +168,7 @@ tle_event_active(struct tle_event *ev, enum tle_ev_state st) { struct tle_evq *q; - if (st == ev->state) + if (ev->state != TLE_SEV_IDLE) return; q = ev->head; diff --git a/test/gtest/test_tle_udp_event.cpp b/test/gtest/test_tle_udp_event.cpp index c7c25a0..c012ccc 100644 --- a/test/gtest/test_tle_udp_event.cpp +++ b/test/gtest/test_tle_udp_event.cpp @@ -125,6 +125,7 @@ INSTANTIATE_TEST_CASE_P(Default, udp_event_state_active_twice, event_state_active_twice{TLE_SEV_IDLE, TLE_SEV_DOWN, TLE_SEV_DOWN}, event_state_active_twice{TLE_SEV_IDLE, TLE_SEV_UP, TLE_SEV_UP}, event_state_active_twice{TLE_SEV_DOWN, TLE_SEV_IDLE, TLE_SEV_DOWN}, + event_state_active_twice{TLE_SEV_DOWN, TLE_SEV_UP, TLE_SEV_DOWN}, event_state_active_twice{TLE_SEV_DOWN, TLE_SEV_DOWN, TLE_SEV_DOWN}, event_state_active_twice{TLE_SEV_UP, TLE_SEV_IDLE, TLE_SEV_UP}, event_state_active_twice{TLE_SEV_UP, TLE_SEV_DOWN, TLE_SEV_UP},