[control] Start and resolver (QC nits): the live tree goes through the same rules as an apply before control writes it to the engines, and a guard frees an edge name lookup's entry and thread on every way out, a panic included
This commit is contained in:
@@ -130,12 +130,28 @@ impl Resolver {
|
||||
.spawn({
|
||||
let key = key.clone();
|
||||
move || {
|
||||
// Removes the name's entry and frees the thread's place on every way out, a
|
||||
// panic in the resolver included: the next request for the name starts a
|
||||
// new lookup instead of joining a dead one.
|
||||
struct Done {
|
||||
inflight: Arc<Inflight>,
|
||||
key: (String, u16),
|
||||
_permit: OwnedSemaphorePermit,
|
||||
}
|
||||
impl Drop for Done {
|
||||
fn drop(&mut self) {
|
||||
lock(&self.inflight).remove(&self.key);
|
||||
}
|
||||
}
|
||||
let _done = Done {
|
||||
inflight,
|
||||
key: key.clone(),
|
||||
_permit: permit,
|
||||
};
|
||||
let answer = lookup(&key.0, key.1)
|
||||
.map(Arc::new)
|
||||
.map_err(|e| (e.kind(), e.to_string()));
|
||||
let _ = tx.send(Some(answer));
|
||||
lock(&inflight).remove(&key);
|
||||
drop(permit);
|
||||
}
|
||||
});
|
||||
if let Err(e) = spawned {
|
||||
|
||||
Reference in New Issue
Block a user