From 77c88dd0dfd79579b217aaf188a060c1e11d37e2 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Tue, 12 Mar 2019 16:23:16 +0100 Subject: [PATCH] - IEC 61850 server: reporting - fixed problem with removing old GI reports when latest report is also GI --- src/iec61850/server/mms_mapping/reporting.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/iec61850/server/mms_mapping/reporting.c b/src/iec61850/server/mms_mapping/reporting.c index 34004053..3a2e048f 100644 --- a/src/iec61850/server/mms_mapping/reporting.c +++ b/src/iec61850/server/mms_mapping/reporting.c @@ -2167,7 +2167,6 @@ removeAllGIReportsFromReportBuffer(ReportBuffer* reportBuffer) } else { lastReport->next = currentReport->next; - } #if (DEBUG_IED_SERVER == 1) @@ -2179,12 +2178,20 @@ removeAllGIReportsFromReportBuffer(ReportBuffer* reportBuffer) if (reportBuffer->nextToTransmit == currentReport) reportBuffer->nextToTransmit = currentReport->next; - currentReport = currentReport->next; + if (reportBuffer->lastEnqueuedReport == currentReport) { + if (lastReport != NULL) { + reportBuffer->lastEnqueuedReport = lastReport; + } + else { + reportBuffer->lastEnqueuedReport = reportBuffer->oldestReport; + } + } } else { lastReport = currentReport; - currentReport = currentReport->next; } + + currentReport = currentReport->next; } if (reportBuffer->oldestReport == NULL)