在 DataChangeCallback 中添加 BadNoSubscription 错误检测
This commit is contained in:
parent
d4d5749ccc
commit
afab910780
|
|
@ -1074,6 +1074,21 @@ impl ConnectionManager {
|
|||
0,
|
||||
true,
|
||||
opcua::client::DataChangeCallback::new(move |dv, item| {
|
||||
// 检查是否有 BadNoSubscription 错误
|
||||
if let Some(status) = &dv.status {
|
||||
if *status == opcua::types::StatusCode::BadNoSubscription {
|
||||
tracing::warn!(
|
||||
"Detected BadNoSubscription in data change callback for source {}, triggering reconnection",
|
||||
current_source_id
|
||||
);
|
||||
// 触发重连
|
||||
if let Some(tx) = manager.reconnect_tx.as_ref() {
|
||||
let _ = tx.send(current_source_id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let client_handle = item.client_handle();
|
||||
let val = dv.value;
|
||||
let timex = Some(Utc::now());
|
||||
|
|
|
|||
Loading…
Reference in New Issue