Skip to content

Commit 2984236

Browse files
committed
move to _mayReuse
1 parent 95bdcc7 commit 2984236

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/src/pool/pool_impl.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class PoolImplementation<L> implements Pool<L> {
177177
Future<_PoolConnection> _selectOrCreate(
178178
Endpoint endpoint, ResolvedConnectionSettings settings) async {
179179
final oldc =
180-
_connections.firstWhereOrNull((c) => c._mayReuse(endpoint, settings) && c.isOpen);
180+
_connections.firstWhereOrNull((c) => c._mayReuse(endpoint, settings));
181181
if (oldc != null) {
182182
// NOTE: It is important to update the _isInUse flag here, otherwise
183183
// race conditions may create conflicts.
@@ -232,7 +232,7 @@ class _PoolConnection implements Connection {
232232
this._pool, this._endpoint, this._connectionSettings, this._connection);
233233

234234
bool _mayReuse(Endpoint endpoint, ResolvedConnectionSettings settings) {
235-
if (_isInUse || endpoint != _endpoint || _isExpired()) {
235+
if (_isInUse || endpoint != _endpoint || _isExpired() || !isOpen) {
236236
return false;
237237
}
238238
if (!_connectionSettings.isMatchingConnection(settings)) {

0 commit comments

Comments
 (0)