Skip to content

Commit

Permalink
update SelectEndpoint call
Browse files Browse the repository at this point in the history
  • Loading branch information
NovaFell committed Dec 3, 2024
1 parent 26ed22d commit f3e85a2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions examples/datetime/datetime.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ func main() {
if err != nil {
log.Fatal(err)
}
ep := opcua.SelectEndpoint(endpoints, *policy, ua.MessageSecurityModeFromString(*mode))
if ep == nil {
log.Fatal("Failed to find suitable endpoint")
ep, err := opcua.SelectEndpoint(endpoints, *policy, ua.MessageSecurityModeFromString(*mode))
if err == nil {
log.Fatal(err)
}

fmt.Println("*", ep.SecurityPolicyURI, ep.SecurityMode)
Expand Down
6 changes: 3 additions & 3 deletions examples/monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ func main() {
log.Fatal(err)
}

ep := opcua.SelectEndpoint(endpoints, *policy, ua.MessageSecurityModeFromString(*mode))
if ep == nil {
log.Fatal("Failed to find suitable endpoint")
ep, err := opcua.SelectEndpoint(endpoints, *policy, ua.MessageSecurityModeFromString(*mode))
if err == nil {
log.Fatal(err)
}

log.Print("*", ep.SecurityPolicyURI, ep.SecurityMode)
Expand Down
6 changes: 3 additions & 3 deletions examples/subscribe/subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ func main() {
if err != nil {
log.Fatal(err)
}
ep := opcua.SelectEndpoint(endpoints, *policy, ua.MessageSecurityModeFromString(*mode))
if ep == nil {
log.Fatal("Failed to find suitable endpoint")
ep, err := opcua.SelectEndpoint(endpoints, *policy, ua.MessageSecurityModeFromString(*mode))
if err == nil {
log.Fatal(err)
}
ep.EndpointURL = *endpoint

Expand Down
6 changes: 3 additions & 3 deletions examples/trigger/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ func main() {
if err != nil {
log.Fatal(err)
}
ep := opcua.SelectEndpoint(endpoints, *policy, ua.MessageSecurityModeFromString(*mode))
if ep == nil {
log.Fatal("Failed to find suitable endpoint")
ep, err := opcua.SelectEndpoint(endpoints, *policy, ua.MessageSecurityModeFromString(*mode))
if err == nil {
log.Fatal(err)
}

fmt.Println("*", ep.SecurityPolicyURI, ep.SecurityMode)
Expand Down
6 changes: 3 additions & 3 deletions examples/udt/udt.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func main() {
if err != nil {
log.Fatal(err)
}
ep := opcua.SelectEndpoint(endpoints, *policy, ua.MessageSecurityModeFromString(*mode))
if ep == nil {
log.Fatal("Failed to find suitable endpoint")
ep, err := opcua.SelectEndpoint(endpoints, *policy, ua.MessageSecurityModeFromString(*mode))
if err == nil {
log.Fatal(err)
}

fmt.Println("*", ep.SecurityPolicyURI, ep.SecurityMode)
Expand Down

0 comments on commit f3e85a2

Please sign in to comment.