fix(inputs.opcua_listener): Avoid segfault if subscription was not successful (#13742)
This commit is contained in:
parent
3fe151b28d
commit
96a9597720
|
|
@ -83,10 +83,11 @@ func (o *SubscribeClient) Connect() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *SubscribeClient) Stop(ctx context.Context) <-chan struct{} {
|
func (o *SubscribeClient) Stop(ctx context.Context) <-chan struct{} {
|
||||||
o.Log.Debugf("Opc Subscribe Stopped")
|
o.Log.Debugf("Stopping OPC subscription...")
|
||||||
err := o.sub.Cancel(ctx)
|
if o.sub != nil {
|
||||||
if err != nil {
|
if err := o.sub.Cancel(ctx); err != nil {
|
||||||
o.Log.Warn("Cancelling OPC UA subscription failed with error ", err)
|
o.Log.Warn("Cancelling OPC UA subscription failed with error ", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
closing := o.OpcUAInputClient.Stop(ctx)
|
closing := o.OpcUAInputClient.Stop(ctx)
|
||||||
o.processingCancel()
|
o.processingCancel()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue