summaryrefslogtreecommitdiff
path: root/psycopg/connection_int.c
diff options
context:
space:
mode:
Diffstat (limited to 'psycopg/connection_int.c')
-rw-r--r--psycopg/connection_int.c7
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;
}