diff options
| author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-04-21 16:20:16 +0100 |
|---|---|---|
| committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-04-21 16:20:16 +0100 |
| commit | 7af0bf0b54524378b6fc1f58781e65b252ed730b (patch) | |
| tree | 10b6b685d8fd4eb2b9bef701276c6ad85924f99d /psycopg/connection_int.c | |
| parent | d71520db9a7fdd4739677ad066fd8a3d9b118d75 (diff) | |
| download | psycopg2-7af0bf0b54524378b6fc1f58781e65b252ed730b.tar.gz | |
Set the async_status to ASYNC_DONE after a query with wait callback.
Failing in doing that broke notifications reception.
The responsibility for changing the async_status has been moved to the
poll function: this is consistent with how the async branch is
implemented.
With this commit all the test suite passes in "green" mode.
Diffstat (limited to 'psycopg/connection_int.c')
| -rw-r--r-- | psycopg/connection_int.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c index e564cfc..e12e3c3 100644 --- a/psycopg/connection_int.c +++ b/psycopg/connection_int.c @@ -721,6 +721,9 @@ conn_poll_green(connectionObject *self) if (PQisBusy(self->pgconn)) { res = PSYCO_POLL_READ; } else { + /* Reading complete: set the async status so that a spare poll() + will only look for NOTIFYs */ + self->async_status = ASYNC_DONE; res = PSYCO_POLL_OK; } break; @@ -729,7 +732,10 @@ conn_poll_green(connectionObject *self) Dprintf("conn_poll: async_status = ASYNC_WRITE"); switch (PQflush(self->pgconn)) { case 0: /* success */ - res = PSYCO_POLL_OK; + /* we've finished pushing the query to the server. Let's start + reading the results. */ + self->async_status = ASYNC_READ; + res = PSYCO_POLL_READ; break; case 1: /* would block */ res = PSYCO_POLL_WRITE; |
