Skip to content

Commit e772544

Browse files
committed
Limit commands delivered by i104m to the first two ip addresses.
1 parent fb92c5b commit e772544

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Diff for: src/i104m/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ One connection must be created for each instance in "protocolConnections":
4040
"enabled": true, // enable the connection
4141
"commandsEnabled": true, // enable commands for the connection (if false, no commands will be forwarded)
4242
"ipAddressLocalBind": "0.0.0.0:8099", // bind address and port to listen for UPD messages
43-
"ipAddresses": ["127.0.0.1:8098"] // only accept messages from addresses here, deliver commands to IP:port
43+
"ipAddresses": ["127.0.0.1:8098"] // only accept messages from addresses here, deliver commands only to the first two to IP:port of this list
4444
})
4545

4646

Diff for: src/i104m/i104m.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import (
4040
"go.mongodb.org/mongo-driver/mongo/options"
4141
)
4242

43-
var softwareVersion string = "{json:scada} I104M Protocol Driver v.0.1.1 - Copyright 2020 Ricardo L. Olsen"
43+
var softwareVersion string = "{json:scada} I104M Protocol Driver v.0.1.2 - Copyright 2020-2021 Ricardo L. Olsen"
4444
var driverName string = "I104M"
4545
var isActive bool = false
4646

@@ -278,7 +278,12 @@ func iterateChangeStream(routineCtx context.Context, waitGroup *sync.WaitGroup,
278278

279279
errMsg := ""
280280
ok := false
281-
for _, ipAddressDest := range protCon.IPAddresses {
281+
for i, ipAddressDest := range protCon.IPAddresses {
282+
283+
if i >= 2 { // only send to the first 2 addresses
284+
break
285+
}
286+
282287
if strings.TrimSpace(ipAddressDest) == "" {
283288
errMsg = "no IP destination"
284289
continue

0 commit comments

Comments
 (0)