Skip to content

Commit

Permalink
Catch case where VISA gives us a stale resource
Browse files Browse the repository at this point in the history
  • Loading branch information
esarver committed Sep 24, 2024
1 parent a95fd8c commit b82e365
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kic-discover-visa/src/visa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ pub async fn visa_discover(timeout: Option<Duration>) -> anyhow::Result<HashSet<
continue;
}
trace!("Connecting to {i:?} to get info");
let mut connected = rm.open(&i, AccessMode::NO_LOCK, visa_rs::TIMEOUT_IMMEDIATE)?;
let mut connected = match rm.open(&i, AccessMode::NO_LOCK, visa_rs::TIMEOUT_IMMEDIATE) {
Ok(c) => c,
Err(_) => {
trace!("Resource {i} no longer available, skipping.");
continue;
}
};

trace!("Getting info from {connected:?}");
let mut info = get_info(&mut connected)?;
info.address = Some(ConnectionAddr::Visa(i.clone()));
Expand Down

0 comments on commit b82e365

Please sign in to comment.