summaryrefslogtreecommitdiff
path: root/psycopg/connection_int.c
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-04-21 11:49:09 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-04-21 15:21:33 +0100
commitc1f0d4d46cb1f177e5966ed2d8bba413410ec424 (patch)
treea5f7db6b417fa7ff938f03443b66d53c2f53f686 /psycopg/connection_int.c
parent4bb0c3bdf6c32bf01d8ae0aa51da9b69ef36b794 (diff)
downloadpsycopg2-c1f0d4d46cb1f177e5966ed2d8bba413410ec424.tar.gz
Read notifications when polling an idle sync connection.
Diffstat (limited to 'psycopg/connection_int.c')
-rw-r--r--psycopg/connection_int.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c
index 1d68c98..dd80576 100644
--- a/psycopg/connection_int.c
+++ b/psycopg/connection_int.c
@@ -741,6 +741,24 @@ conn_poll_green(connectionObject *self)
}
break;
+ case ASYNC_DONE:
+ Dprintf("conn_poll: async_status = ASYNC_DONE");
+ /* We haven't asked anything: just check for notifications. */
+ switch (pq_is_busy(self)) {
+ case 0: /* will not block */
+ res = PSYCO_POLL_OK;
+ break;
+ case 1: /* will block */
+ res = PSYCO_POLL_READ;
+ break;
+ case -1: /* ouch, error */
+ break;
+ default:
+ Dprintf("conn_poll: unexpected result from pq_is_busy");
+ break;
+ }
+ break;
+
default:
Dprintf("conn_poll: in unexpected async status: %d",
self->async_status);