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.
This commit is contained in:
Daniele Varrazzo 2014-02-24 11:39:43 +00:00
parent 211e949741
commit a8ef13620a

View File

@ -506,10 +506,6 @@ conn_setup(connectionObject *self, PGconn *pgconn)
pthread_mutex_lock(&self->lock); pthread_mutex_lock(&self->lock);
Py_BLOCK_THREADS; Py_BLOCK_THREADS;
if (psyco_green() && (0 > pq_set_non_blocking(self, 1))) {
return -1;
}
if (!conn_is_datestyle_ok(self->pgconn)) { if (!conn_is_datestyle_ok(self->pgconn)) {
int res; int res;
Py_UNBLOCK_THREADS; Py_UNBLOCK_THREADS;
@ -573,6 +569,9 @@ _conn_sync_connect(connectionObject *self)
/* if the connection is green, wait to finish connection */ /* if the connection is green, wait to finish connection */
if (green) { if (green) {
if (0 > pq_set_non_blocking(self, 1)) {
return -1;
}
if (0 != psyco_wait(self)) { if (0 != psyco_wait(self)) {
return -1; return -1;
} }