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 #441, cf delete files during error when tx #443

Closed
wants to merge 3 commits into from

Conversation

avan989
Copy link

@avan989 avan989 commented May 16, 2024

Fix #441, Update to handle error during tx.

  1. For polling, the file gets moved or deleted to pervent infinite loop
  2. For others, the file does not get deleted.

Checklist (Please check before submitting)

Describe the contribution
A clear and concise description of what the contribution is.
Fixes #441, cf was deleting file during error. This update how the cf handle error during tx.

Testing performed
Steps taken to test the contribution:
Tested against DACINCI's build

  1. Set the polling directory to class 2 (ACK)
  2. make SIMULATION=native TARGET=pclinux prep
  3. make install
  4. Create a 100KB.txt file.
  5. Tested with polling directory and tested with tx file command.

Expected behavior changes
A clear and concise description of how this contribution will change behavior and level of impact.
Two updates:

  1. If an error occurs in a polling directory - it will attempt to move the file to a "fail directory". If it cannot, it will delete the file to prevent an infinite cycle of trying to transmit.
  2. If it was a tx file command and not in a polling directory, it would not delete the file.

System(s) tested on
docker - ubunutu 22.04

Additional context
Add any other context about the contribution here.

Third party code
If included, identify any third party code and provide text file of the license

Contributor Info - All information REQUIRED for consideration of pull request
Full name and company/organization/center of all contributors ("Personal" if individual work)

  • Note CLA's apply to software contributions.
    Anh Van, GSFC

fsw/src/cf_cfdp.c Fixed Show fixed Hide fixed
fsw/src/cf_cfdp.c Fixed Show fixed Hide fixed
* See description in cf_cfdp.h for argument/return detail
*
*-----------------------------------------------------------------*/
bool CF_CFDP_IsPollingDir(const char * src_file, uint8 chan_num)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
fsw/src/cf_cfdp.c Outdated Show resolved Hide resolved
Fix nasa#441, Update to handle error during tx.
1. For polling, the file gets moved or deleted to pervent infinite loop
2. For others, the file does not get deleted.
@avan989 avan989 force-pushed the Fix-441-cf-delete-file-tx-error branch from 9fafd0f to e187427 Compare May 17, 2024 15:05
void CF_CFDP_HandleNotKeepFile(CF_Transaction_t *txn)
{
/* Sender */
if (CF_CFDP_IsSender(txn))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning

This Boolean expression is not side-effect free.
* See description in cf_cfdp.h for argument/return detail
*
*-----------------------------------------------------------------*/
void CF_CFDP_MoveFile(const char *src, const char *dest_dir)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
* See description in cf_cfdp.h for argument/return detail
*
*-----------------------------------------------------------------*/
void CF_CFDP_HandleNotKeepFile(CF_Transaction_t *txn)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@avan989
Copy link
Author

avan989 commented Jul 31, 2024

closing pull request.

@avan989 avan989 closed this Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cf delete file when there is an error during tx
2 participants