Turn Option<AgentState> into AgentState (#149)
`Some(AgentState)` seem to be assumed pretty much everywhere. I could not find any test or piece of code hinting at how `None` should be interpreted, or even see how a state of `None` could even be constructed. Co-authored-by: Ulrik <ulrikm@spotify.com>
This commit is contained in:
14
src/pool.rs
14
src/pool.rs
@@ -381,15 +381,13 @@ impl<R: Read + Sized + Into<Stream>> PoolReturnRead<R> {
|
||||
let state = &mut unit.agent.lock().unwrap();
|
||||
// bring back stream here to either go into pool or dealloc
|
||||
let stream = reader.into();
|
||||
if let Some(agent) = state.as_mut() {
|
||||
if !stream.is_poolable() {
|
||||
// just let it deallocate
|
||||
return;
|
||||
}
|
||||
// insert back into pool
|
||||
let key = PoolKey::new(&unit.url, &unit.proxy);
|
||||
agent.pool().add(key, stream);
|
||||
if !stream.is_poolable() {
|
||||
// just let it deallocate
|
||||
return;
|
||||
}
|
||||
// insert back into pool
|
||||
let key = PoolKey::new(&unit.url, &unit.proxy);
|
||||
state.pool().add(key, stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user