Skip to content

Commit

Permalink
Merge pull request #47 from fledge-iot/FOGL-9094
Browse files Browse the repository at this point in the history
FOGL-9094: skip duplicate entry in outstation list
  • Loading branch information
pintomax authored Sep 6, 2024
2 parents 1a93a65 + 0a0f2b2 commit 88cf629
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dnp3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ bool DNP3::start()

this->unlockConfig();

Logger::getLogger()->info("Found %d DNP3 TCP outstation configured", m_outstations.size());

// Iterate outstation array
for (OutStationTCP *outstation : m_outstations)
{
Expand Down
15 changes: 15 additions & 0 deletions include/south_dnp3.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,21 @@ class DNP3
// Add outstation
void addOutStationTCP(OutStationTCP *outstation)
{
for (OutStationTCP *o : m_outstations)
{
if (o->linkId == outstation->linkId &&
o->port == outstation->port &&
o->address == outstation->address)
{
Logger::getLogger()->error("Skip outstation entry in the list as an outstation " \
"already exists with address %s, port %d and linkId %d",
outstation->address.c_str(),
outstation->port,
outstation->linkId);
return;
}
}

m_outstations.push_back(outstation);
};

Expand Down

0 comments on commit 88cf629

Please sign in to comment.