1
0
Fork 0
mirror of https://github.com/librespot-org/librespot.git synced 2025-10-03 01:39:28 +02:00

minor cleanup

This commit is contained in:
Evan Cameron 2021-02-28 21:37:22 -05:00
parent 9d77fef008
commit 6a33eb4efa
No known key found for this signature in database
GPG key ID: 6878FBDAB459783C
27 changed files with 172 additions and 212 deletions

View file

@ -211,30 +211,28 @@ impl MercuryManager {
if let Some(cb) = pending.callback {
let _ = cb.send(Err(MercuryError));
}
} else {
if cmd == 0xb5 {
self.lock(|inner| {
let mut found = false;
inner.subscriptions.retain(|&(ref prefix, ref sub)| {
if response.uri.starts_with(prefix) {
found = true;
} else if cmd == 0xb5 {
self.lock(|inner| {
let mut found = false;
inner.subscriptions.retain(|&(ref prefix, ref sub)| {
if response.uri.starts_with(prefix) {
found = true;
// if send fails, remove from list of subs
// TODO: send unsub message
sub.send(response.clone()).is_ok()
} else {
// URI doesn't match
true
}
});
if !found {
debug!("unknown subscription uri={}", response.uri);
// if send fails, remove from list of subs
// TODO: send unsub message
sub.send(response.clone()).is_ok()
} else {
// URI doesn't match
true
}
})
} else if let Some(cb) = pending.callback {
let _ = cb.send(Ok(response));
}
});
if !found {
debug!("unknown subscription uri={}", response.uri);
}
})
} else if let Some(cb) = pending.callback {
let _ = cb.send(Ok(response));
}
}