From 2d75ced4edcc9d31268699942e9cf82e16c65ff0 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Wed, 21 Mar 2018 11:51:08 -0700 Subject: [PATCH] fix client connection pooling --- CHANGES.md | 5 +++++ src/client/connector.rs | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 67798f4d1..3049061cc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,10 @@ # Changes +## 0.4.11 + +* Fix client connection pooling + + ## 0.4.10 (2018-03-20) * Use `Error` instead of `InternalError` for `error::ErrorXXXX` methods diff --git a/src/client/connector.rs b/src/client/connector.rs index 5a4572369..8f2828935 100644 --- a/src/client/connector.rs +++ b/src/client/connector.rs @@ -232,7 +232,8 @@ impl Handler for ClientConnector { let key = Key {host, port, ssl: proto.is_secure()}; 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)) } else { Some(Rc::clone(&self.pool)) @@ -452,6 +453,8 @@ impl Pool { self.to_close.borrow_mut().push(conn.1); } } + } else { + self.to_close.borrow_mut().push(conn); } } }