Skip to content

Commit

Permalink
Merge pull request #379 from skliper/fix377_semtimeouterror
Browse files Browse the repository at this point in the history
Fix #377, Remove error event on nominal semaphore timeout
  • Loading branch information
dzbaker authored Apr 13, 2023
2 parents b0269ef + c92fb8e commit 433ed5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fsw/src/cf_cfdp_sbintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *t, bool silent
if (!CF_AppData.engine.out.msg)
{
c->cur = t; /* remember where we were for next time */
if (!silent)
if (!silent && (os_status == OS_SUCCESS))
{
CFE_EVS_SendEvent(CF_EID_ERR_CFDP_NO_MSG, CFE_EVS_EventType_ERROR,
"CF: no output message buffer available");
Expand Down
10 changes: 5 additions & 5 deletions unit-test/cf_cfdp_sbintf_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,18 +372,18 @@ void Test_CF_CFDP_MsgOutGet(void)
UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &c, NULL, &t, NULL);
c->sem_id = OS_ObjectIdFromInteger(123);
UtAssert_NOT_NULL(CF_CFDP_MsgOutGet(t, false));
UT_SetDefaultReturnValue(UT_KEY(OS_CountSemTimedWait), OS_ERROR_TIMEOUT);
UT_SetDeferredRetcode(UT_KEY(OS_CountSemTimedWait), 1, OS_ERROR_TIMEOUT);
UtAssert_NULL(CF_CFDP_MsgOutGet(t, false));
UT_CF_AssertEventID(CF_EID_ERR_CFDP_NO_MSG);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);

/* transaction is suspended */
UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL);
UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL);
t->flags.com.suspended = 1;
UtAssert_NULL(CF_CFDP_MsgOutGet(t, false));
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);

/* channel is frozen */
UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL);
UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL);
CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].frozen = 1;
UtAssert_NULL(CF_CFDP_MsgOutGet(t, false));
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
Expand All @@ -394,7 +394,7 @@ void Test_CF_CFDP_MsgOutGet(void)
UtAssert_NULL(CF_CFDP_MsgOutGet(t, false));
UT_CF_AssertEventID(CF_EID_ERR_CFDP_NO_MSG);

/* same, but the silent flag should supress the event */
/* same, but the silent flag should suppress the event */
UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL);
UtAssert_NULL(CF_CFDP_MsgOutGet(t, true));
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
Expand Down

0 comments on commit 433ed5c

Please sign in to comment.