diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-02-21 10:42:13 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-02-21 10:42:13 +0200 |
commit | cfc9c1fa3cab07396b38d192da3d0b6bfa36d0f5 (patch) | |
tree | 4070182474950d34f62fe5f2a828e160540753e6 /odb/mysql/connection-factory.cxx | |
parent | 4acabe57939ff37bad0a8aabc5164b6d5add449b (diff) |
Don't reuse failed connections
If MySQL API returns an error indicating the connection is no longer
usable, mark it as failed. In connection_pool_factory free failed
connections instead of returning them to the pool.
Diffstat (limited to 'odb/mysql/connection-factory.cxx')
-rw-r--r-- | odb/mysql/connection-factory.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/odb/mysql/connection-factory.cxx b/odb/mysql/connection-factory.cxx index dce0f97..b9b3d19 100644 --- a/odb/mysql/connection-factory.cxx +++ b/odb/mysql/connection-factory.cxx @@ -230,9 +230,10 @@ namespace odb // Determine if we need to keep or free this connection. // - bool keep (waiters_ != 0 || - min_ == 0 || - (connections_.size () + in_use_ <= min_)); + bool keep (!c->failed () && + (waiters_ != 0 || + min_ == 0 || + (connections_.size () + in_use_ <= min_))); in_use_--; |