- IED server: integrated GOOSE publisher - lock data model during GOOSE retransmission to avoid corrupted GOOSE data

pull/331/head
Michael Zillgith 5 years ago
parent f49be0d844
commit 4e15343f5b

@ -55,7 +55,7 @@ LIB61850_INTERNAL bool
MmsGooseControlBlock_isEnabled(MmsGooseControlBlock self);
LIB61850_INTERNAL void
MmsGooseControlBlock_checkAndPublish(MmsGooseControlBlock self, uint64_t currentTime);
MmsGooseControlBlock_checkAndPublish(MmsGooseControlBlock self, uint64_t currentTime, MmsMapping* mapping);
LIB61850_INTERNAL void
MmsGooseControlBlock_setStateChangePending(MmsGooseControlBlock self);

@ -506,11 +506,15 @@ MmsGooseControlBlock_disable(MmsGooseControlBlock self, MmsMapping* mmsMapping)
void
MmsGooseControlBlock_checkAndPublish(MmsGooseControlBlock self, uint64_t currentTime)
MmsGooseControlBlock_checkAndPublish(MmsGooseControlBlock self, uint64_t currentTime, MmsMapping* mapping)
{
if (self->publisher) {
if (currentTime >= self->nextPublishTime) {
IedServer_lockDataModel(mapping->iedServer);
if (currentTime >= self->nextPublishTime) {
#if (CONFIG_MMS_THREADLESS_STACK != 1)
Semaphore_wait(self->publisherMutex);
#endif
@ -538,6 +542,10 @@ MmsGooseControlBlock_checkAndPublish(MmsGooseControlBlock self, uint64_t current
Semaphore_post(self->publisherMutex);
#endif
}
IedServer_unlockDataModel(mapping->iedServer);
}
else if ((self->nextPublishTime - currentTime) > ((uint32_t) self->maxTime * 2)) {
self->nextPublishTime = currentTime + self->minTime;
}

@ -3748,7 +3748,7 @@ GOOSE_processGooseEvents(MmsMapping* self, uint64_t currentTimeInMs)
MmsGooseControlBlock mmsGCB = (MmsGooseControlBlock) element->data;
if (MmsGooseControlBlock_isEnabled(mmsGCB)) {
MmsGooseControlBlock_checkAndPublish(mmsGCB, currentTimeInMs);
MmsGooseControlBlock_checkAndPublish(mmsGCB, currentTimeInMs, self);
}
element = LinkedList_getNext(element);

Loading…
Cancel
Save