1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-24 16:02:59 +01:00

fix alpn connector

This commit is contained in:
Nikolay Kim 2018-06-23 17:59:45 +06:00
parent 3d2226aa9e
commit 348491b18c
2 changed files with 7 additions and 6 deletions

View File

@ -837,9 +837,9 @@ impl fut::ActorFuture for Maintenance {
act.collect_waiters(); act.collect_waiters();
// check waiters // check waiters
let mut waiters = act.waiters.take().unwrap(); let mut act_waiters = act.waiters.take().unwrap();
for (key, waiters) in &mut waiters { for (key, ref mut waiters) in &mut act_waiters {
while let Some(waiter) = waiters.pop_front() { while let Some(waiter) = waiters.pop_front() {
if waiter.tx.is_canceled() { if waiter.tx.is_canceled() {
continue; continue;
@ -858,10 +858,11 @@ impl fut::ActorFuture for Maintenance {
break; break;
} }
Acquire::Available => { Acquire::Available => {
let key = key.clone();
let conn = AcquiredConn(key.clone(), Some(act.acq_tx.clone())); let conn = AcquiredConn(key.clone(), Some(act.acq_tx.clone()));
fut::WrapFuture::<ClientConnector>::actfuture( fut::WrapFuture::<ClientConnector>::actfuture(
Resolver::from_registry().send( act.resolver.as_ref().unwrap().send(
ResolveConnect::host_and_port(&conn.0.host, conn.0.port) ResolveConnect::host_and_port(&conn.0.host, conn.0.port)
.timeout(waiter.conn_timeout), .timeout(waiter.conn_timeout),
), ),
@ -898,7 +899,7 @@ impl fut::ActorFuture for Maintenance {
} }
Ok(()) Ok(())
}) })
.actfuture(), .into_actor(act),
) )
} else { } else {
let _ = waiter.tx.send(Ok(Connection::new( let _ = waiter.tx.send(Ok(Connection::new(
@ -986,7 +987,7 @@ impl fut::ActorFuture for Maintenance {
} }
} }
act.waiters = Some(waiters); act.waiters = Some(act_waiters);
Ok(Async::NotReady) Ok(Async::NotReady)
} }
} }

View File

@ -841,7 +841,7 @@ mod tests {
Pipeline(info, PipelineState::Completed(state), Rc::new(Vec::new())); Pipeline(info, PipelineState::Completed(state), Rc::new(Vec::new()));
assert!(!pp.is_done()); assert!(!pp.is_done());
let Pipeline(mut info, st, mws) = pp; let Pipeline(mut info, st, _) = pp;
let mut st = st.completed().unwrap(); let mut st = st.completed().unwrap();
drop(addr); drop(addr);