mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-30 18:44:35 +01:00
fix awc client panic #1016
This commit is contained in:
parent
52372fcbea
commit
7674f1173c
@ -4,8 +4,11 @@
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
* awc client panic #1016
|
||||||
|
|
||||||
* Invalid response with compression middleware enabled, but compression-related features disabled #997
|
* Invalid response with compression middleware enabled, but compression-related features disabled #997
|
||||||
|
|
||||||
|
|
||||||
## [0.2.7] - 2019-07-18
|
## [0.2.7] - 2019-07-18
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -305,10 +305,12 @@ pub(crate) struct Inner<Io> {
|
|||||||
limit: usize,
|
limit: usize,
|
||||||
acquired: usize,
|
acquired: usize,
|
||||||
available: HashMap<Key, VecDeque<AvailableConnection<Io>>>,
|
available: HashMap<Key, VecDeque<AvailableConnection<Io>>>,
|
||||||
waiters: Slab<(
|
waiters: Slab<
|
||||||
|
Option<(
|
||||||
Connect,
|
Connect,
|
||||||
oneshot::Sender<Result<IoConnection<Io>, ConnectError>>,
|
oneshot::Sender<Result<IoConnection<Io>, ConnectError>>,
|
||||||
)>,
|
)>,
|
||||||
|
>,
|
||||||
waiters_queue: IndexSet<(Key, usize)>,
|
waiters_queue: IndexSet<(Key, usize)>,
|
||||||
task: Option<AtomicTask>,
|
task: Option<AtomicTask>,
|
||||||
}
|
}
|
||||||
@ -346,7 +348,7 @@ where
|
|||||||
let key: Key = connect.uri.authority_part().unwrap().clone().into();
|
let key: Key = connect.uri.authority_part().unwrap().clone().into();
|
||||||
let entry = self.waiters.vacant_entry();
|
let entry = self.waiters.vacant_entry();
|
||||||
let token = entry.key();
|
let token = entry.key();
|
||||||
entry.insert((connect, tx));
|
entry.insert(Some((connect, tx)));
|
||||||
assert!(self.waiters_queue.insert((key, token)));
|
assert!(self.waiters_queue.insert((key, token)));
|
||||||
|
|
||||||
(rx, token, self.task.is_some())
|
(rx, token, self.task.is_some())
|
||||||
@ -499,10 +501,14 @@ where
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if inner.waiters.get(token).unwrap().is_none() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
match inner.acquire(&key) {
|
match inner.acquire(&key) {
|
||||||
Acquire::NotAvailable => break,
|
Acquire::NotAvailable => break,
|
||||||
Acquire::Acquired(io, created) => {
|
Acquire::Acquired(io, created) => {
|
||||||
let (_, tx) = inner.waiters.remove(token);
|
let tx = inner.waiters.get_mut(token).unwrap().take().unwrap().1;
|
||||||
if let Err(conn) = tx.send(Ok(IoConnection::new(
|
if let Err(conn) = tx.send(Ok(IoConnection::new(
|
||||||
io,
|
io,
|
||||||
created,
|
created,
|
||||||
@ -513,7 +519,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Acquire::Available => {
|
Acquire::Available => {
|
||||||
let (connect, tx) = inner.waiters.remove(token);
|
let (connect, tx) =
|
||||||
|
inner.waiters.get_mut(token).unwrap().take().unwrap();
|
||||||
OpenWaitingConnection::spawn(
|
OpenWaitingConnection::spawn(
|
||||||
key.clone(),
|
key.clone(),
|
||||||
tx,
|
tx,
|
||||||
|
Loading…
Reference in New Issue
Block a user