Skip to content

Commit

Permalink
Fix nasa#37: Offset the UDP base port per-CPU
Browse files Browse the repository at this point in the history
Avoid port conflicts when having more than one CPU within the same
mission load CI_LAB app.  Instead of binding to the port directly,
add the CPU number as an offset.  Subtract 1 so that CPU1 remains
at the same port (1234 by default) and cmdUtil is not affected.
  • Loading branch information
jphickey committed Feb 11, 2020
1 parent a9c51f1 commit 321b4a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fsw/src/ci_lab_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ void CI_LAB_delete_callback(void)
void CI_LAB_TaskInit(void)
{
int32 status;
uint16 DefaultListenPort;

memset(&CI_LAB_Global, 0, sizeof(CI_LAB_Global));

Expand All @@ -177,7 +178,8 @@ void CI_LAB_TaskInit(void)
else
{
OS_SocketAddrInit(&CI_LAB_Global.SocketAddress, OS_SocketDomain_INET);
OS_SocketAddrSetPort(&CI_LAB_Global.SocketAddress, cfgCI_LAB_PORT);
DefaultListenPort = cfgCI_LAB_PORT + CFE_PSP_GetProcessorId() - 1;
OS_SocketAddrSetPort(&CI_LAB_Global.SocketAddress, DefaultListenPort);

status = OS_SocketBind(CI_LAB_Global.SocketID, &CI_LAB_Global.SocketAddress);

Expand All @@ -188,6 +190,7 @@ void CI_LAB_TaskInit(void)
else
{
CI_LAB_Global.SocketConnected = true;
CFE_ES_WriteToSysLog("CI_LAB listening on UDP port: %u\n", (unsigned int)DefaultListenPort);
}
}

Expand Down

0 comments on commit 321b4a7

Please sign in to comment.