Browse files

Report connection as closed if internal flag is set or libpq knows th…

…at connection is closed.

This fixes problem when connection is closed on backend side and
conn.closed() still reports False, while conn.fileno() would return -1,
indicating that connection is broken.
  • Loading branch information...
1 parent 433aebb commit 14eac71b670194d788ce8185e27442f14ca05641 @smira committed Dec 28, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 psycopg2ct/_impl/
@@ -361,7 +361,7 @@ def fileno(self):
def closed(self):
- return self._closed
+ return self._closed or (libpq.PQstatus(self._pgconn) == libpq.CONNECTION_BAD)
def xid(self, format_id, gtrid, bqual):

0 comments on commit 14eac71

Please sign in to comment.