Skip to content

Commit

Permalink
Merge branch '313ctric/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Dec 20, 2023
2 parents f9246c0 + e968c27 commit 612ec97
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,9 @@ pub async fn handler<T: AsyncReadExt + AsyncWriteExt + Unpin>(

let mut used_devices = server.used_devices.write().await;
let mut available_devices = server.available_devices.write().await;
let busid_compare = &busid[..busid.iter().position(|&x| x == 0).unwrap_or(busid.len())];
for (i, dev) in available_devices.iter().enumerate() {
let mut expected = dev.bus_id.as_bytes().to_vec();
expected.resize(32, 0);
if expected.as_slice() == busid {
if busid_compare == dev.bus_id.as_bytes() {
let dev = available_devices.remove(i);
let dev_id = dev.bus_id.clone();
used_devices.insert(dev.bus_id.clone(), dev);
Expand Down

0 comments on commit 612ec97

Please sign in to comment.