summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2014-01-08 17:29:18 -0800
committerGuido van Rossum <guido@python.org>2014-01-08 17:29:18 -0800
commitcfc24b5331f32e763bad730bfa49fd29033f8245 (patch)
treeb4540a23a93f7a2e29c06d8e75c6fca08775bf1b /examples
parent9547f346aa5cd8acd3f1b08ffee6fe74916f059d (diff)
downloadtrollius-cfc24b5331f32e763bad730bfa49fd29033f8245.tar.gz
Ignore now-closed connections in pool.
Diffstat (limited to 'examples')
-rw-r--r--examples/fetch3.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/fetch3.py b/examples/fetch3.py
index bdca3ae..9419afd 100644
--- a/examples/fetch3.py
+++ b/examples/fetch3.py
@@ -34,6 +34,10 @@ class ConnectionPool:
key = h, p, ssl
conn = self.connections.get(key)
if conn:
+ reader, writer = conn
+ if reader._eof:
+ self.connections.pop(key)
+ continue
if self.verbose:
print('* Reusing pooled connection', key, file=sys.stderr)
return conn