diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2014-02-24 11:39:43 +0000 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2014-02-24 15:20:01 +0000 |
commit | ca99579b76531735bc902ccc2a2656d7772b9e44 (patch) | |
tree | e0c6071b89ce0568bc3f9823c3db12bbbba732c1 /psycopg/connection_int.c | |
parent | 283dbccf56d1c3fb14eadc66bdd4e2a4bb56974e (diff) | |
download | psycopg2-ca99579b76531735bc902ccc2a2656d7772b9e44.tar.gz |
Set the connection async earlier in green mode
The moment it is called shouldn't have really changed, but it's more
explicit when it happens. Previously it was sort of obfuscated behind a
roundtrip through the green callback and poll.
Diffstat (limited to 'psycopg/connection_int.c')
-rw-r--r-- | psycopg/connection_int.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c index 5069e64..51ebfd2 100644 --- a/psycopg/connection_int.c +++ b/psycopg/connection_int.c @@ -506,10 +506,6 @@ conn_setup(connectionObject *self, PGconn *pgconn) pthread_mutex_lock(&self->lock); Py_BLOCK_THREADS; - if (psyco_green() && (0 > pq_set_non_blocking(self, 1))) { - return -1; - } - if (!conn_is_datestyle_ok(self->pgconn)) { int res; Py_UNBLOCK_THREADS; @@ -573,6 +569,9 @@ _conn_sync_connect(connectionObject *self) /* if the connection is green, wait to finish connection */ if (green) { + if (0 > pq_set_non_blocking(self, 1)) { + return -1; + } if (0 != psyco_wait(self)) { return -1; } |