Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #113, replace acknack count union #115

Merged
merged 2 commits into from
Dec 17, 2021

Conversation

jphickey
Copy link
Contributor

Using a union for the ack/nak counts is somewhat dangerous because undefined behavior will occur if accessed improperly. In this case there is no need to have separate representations of the counter, they are both limited to the "unit8" range, so use a uint8.

Fixes #113

Using a union for the ack/nak counts is somewhat dangerous because
undefined behavior will occur if accessed improperly.  In this case
there is no need to have separate representations of the counter,
they are both limited to the "unit8" range, so use a uint8.
@jphickey jphickey added the CCB:Ready Ready for discussion at the Configuration Control Board (CCB) label Dec 10, 2021
@astrogeco astrogeco added CCB:Approved and removed CCB:Ready Ready for discussion at the Configuration Control Board (CCB) labels Dec 15, 2021
@astrogeco
Copy link
Contributor

CCB: 2021-12-15 APPROVED!

  • Safer and Simpler and saves a little memory

@jphickey
Copy link
Contributor Author

Hold of a bit on merging, I'm seeing intermittent unit test failures after this one (depends on random values being picked). This fixed a FSW issue (using == instead of >= when checking counter limits) and the unit test appears to be actively checking for the incorrect path being followed.

The use of random numbers in a couple test cases was causing an
unpredictable flow through the code.  This replaces with fixed
values so get consistent flows.

Specifically, the "acknak_count" should always be less than the
"ack_limit".  The UT use of random numbers allowed it to be
greater.  However, if it is greater than the limit, it should
still follow the limit/error path, not the successful path.
@jphickey
Copy link
Contributor Author

Minor fix, should be good to go now with commit d800b4b. This just removes the problem random values and puts some fixed numbers to get consistent flow.

@astrogeco astrogeco requested a review from skliper December 16, 2021 23:53
@astrogeco astrogeco merged commit a0d6f56 into nasa:main Dec 17, 2021
@jphickey jphickey deleted the fix-113-acknak-counts branch January 11, 2022 19:24
@skliper skliper added this to the Draco milestone Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Odd union for ack/nak counters
3 participants