1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-10-03 16:51:58 +00:00

fix client connection pooling

This commit is contained in:
Nikolay Kim 2018-03-21 11:51:08 -07:00
parent 7bcc258b09
commit 2d75ced4ed
2 changed files with 9 additions and 1 deletions

View file

@ -1,5 +1,10 @@
# Changes # Changes
## 0.4.11
* Fix client connection pooling
## 0.4.10 (2018-03-20) ## 0.4.10 (2018-03-20)
* Use `Error` instead of `InternalError` for `error::ErrorXXXX` methods * Use `Error` instead of `InternalError` for `error::ErrorXXXX` methods

View file

@ -232,7 +232,8 @@ impl Handler<Connect> for ClientConnector {
let key = Key {host, port, ssl: proto.is_secure()}; let key = Key {host, port, ssl: proto.is_secure()};
let pool = if proto.is_http() { let pool = if proto.is_http() {
if let Some(conn) = self.pool.query(&key) { if let Some(mut conn) = self.pool.query(&key) {
conn.pool = Some(self.pool.clone());
return ActorResponse::async(fut::ok(conn)) return ActorResponse::async(fut::ok(conn))
} else { } else {
Some(Rc::clone(&self.pool)) Some(Rc::clone(&self.pool))
@ -452,6 +453,8 @@ impl Pool {
self.to_close.borrow_mut().push(conn.1); self.to_close.borrow_mut().push(conn.1);
} }
} }
} else {
self.to_close.borrow_mut().push(conn);
} }
} }
} }