From 4822763c88059fe2a55c78b1ce2321a6c509301d Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Mon, 20 Jul 2026 02:01:45 +0900 Subject: [PATCH] throttleRecord: write link-status flags for the correct link special() marked outLinkStat unconditionally in the off-IOC branch even for a .SINP change, and checkLink() carried caLink/caLinkNc across the OUT/SINP loop so SINP's status could be written from OUT's connection state. Select plinkStat per field in special(), and scope caLink/caLinkNc per loop iteration so each link's status is computed only from its own link. init_record was already correct and is left untouched. --- stdApp/src/throttleRecord.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stdApp/src/throttleRecord.c b/stdApp/src/throttleRecord.c index c06100a4..aef3e5a9 100644 --- a/stdApp/src/throttleRecord.c +++ b/stdApp/src/throttleRecord.c @@ -322,6 +322,7 @@ static long special(DBADDR *paddr, int after) struct link *plink; unsigned short *plinkValid; + short *plinkStat; struct dbAddr dbAddr; int new_st; @@ -344,11 +345,13 @@ static long special(DBADDR *paddr, int after) { plink = &prec->out; plinkValid = &prec->ov; + plinkStat = &prpvt->outLinkStat; } else { plink = &prec->sinp; plinkValid = &prec->siv; + plinkStat = &prpvt->sinpLinkStat; } if (plink->type == CONSTANT) @@ -368,7 +371,7 @@ static long special(DBADDR *paddr, int after) { prpvt->pending_checkLinkCB = 1; callbackRequestDelayed(&prpvt->checkLinkCb, 0.5); - prpvt->outLinkStat = CA_LINK_NOT_OK; + *plinkStat = CA_LINK_NOT_OK; } } db_post_events(prec,plinkValid,DBE_VALUE|DBE_LOG); @@ -684,8 +687,6 @@ static void checkLink(struct throttleRecord *prec) { struct rpvtStruct *prpvt = (struct rpvtStruct *)prec->rpvt; int stat; - int caLink = 0; - int caLinkNc = 0; struct link *plink; unsigned short *plinkValid; @@ -697,6 +698,9 @@ static void checkLink(struct throttleRecord *prec) for( i = 0; i < 2; i++) { + int caLink = 0; + int caLinkNc = 0; + if( !i) { plink = &prec->out;