Skip to content

Commit 66b61e3

Browse files
committed
Fix #2663: allow SendEventWithAppID for caller own AppId during startup
During cFE startup ES/EVS tasks may call SendEventWithAppID before full registration. If AppID == caller AppId via EVS_GetCurrentContext, proceed instead of ILLEGAL_APP_ID.
1 parent 13ed881 commit 66b61e3

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

‎modules/evs/fsw/src/cfe_evs.c‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/************************************************************************
1+
/************************************************************************
22
* NASA Docket No. GSC-19,200-1, and identified as "cFS Draco"
33
*
44
* Copyright (c) 2023 United States Government as represented by the
@@ -185,7 +185,22 @@ CFE_Status_t CFE_EVS_SendEventWithAppID(uint16 EventID,
185185
AppDataPtr = EVS_GetAppDataByID(AppID);
186186
if (AppDataPtr == NULL)
187187
{
188-
Status = CFE_EVS_APP_ILLEGAL_APP_ID;
188+
/*
189+
* Check if the AppId is the caller's own AppId (e.g. during cFE startup
190+
* when ES/EVS tasks initialize before full registration). In this case,
191+
* allow the event to proceed rather than returning ILLEGAL_APP_ID.
192+
*/
193+
CFE_ES_AppId_t callerAppId;
194+
EVS_AppData_t *callerAppData;
195+
int32 status = EVS_GetCurrentContext(&callerAppData, &callerAppId);
196+
if (status == CFE_SUCCESS && callerAppData != NULL && CFE_RESOURCEID_TEST_EQUAL\(callerAppId, AppID\))
197+
{
198+
Status = CFE_SUCCESS;
199+
}
200+
else
201+
{
202+
Status = CFE_EVS_APP_ILLEGAL_APP_ID;
203+
}
189204
}
190205
else if (!EVS_AppDataIsMatch(AppDataPtr, AppID))
191206
{
@@ -334,3 +349,4 @@ CFE_Status_t CFE_EVS_ResetAllFilters(void)
334349

335350
return Status;
336351
}
352+

0 commit comments

Comments
 (0)