mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-15 05:26:37 +03:00
Merge branch 'ticket-194' into maint_2_5
This commit is contained in:
commit
a13c72cf32
2
NEWS
2
NEWS
|
@ -6,6 +6,8 @@ What's new in psycopg 2.5.3
|
||||||
|
|
||||||
- Added arbitrary but stable order to `Range` objects, thanks to
|
- Added arbitrary but stable order to `Range` objects, thanks to
|
||||||
Chris Withers (:ticket:`#193`).
|
Chris Withers (:ticket:`#193`).
|
||||||
|
- Avoid blocking async connections on connect (:ticket:`#194`). Thanks to
|
||||||
|
Adam Petrovich for the bug report and diagnosis.
|
||||||
- Fixed debug build on Windows, thanks to James Emerton.
|
- Fixed debug build on Windows, thanks to James Emerton.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -614,6 +613,11 @@ _conn_async_connect(connectionObject *self)
|
||||||
|
|
||||||
PQsetNoticeProcessor(pgconn, conn_notice_callback, (void*)self);
|
PQsetNoticeProcessor(pgconn, conn_notice_callback, (void*)self);
|
||||||
|
|
||||||
|
/* Set the connection to nonblocking now. */
|
||||||
|
if (pq_set_non_blocking(self, 1) != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* The connection will be completed banging on poll():
|
/* The connection will be completed banging on poll():
|
||||||
* First with _conn_poll_connecting() that will finish connection,
|
* First with _conn_poll_connecting() that will finish connection,
|
||||||
* then with _conn_poll_setup_async() that will do the same job
|
* then with _conn_poll_setup_async() that will do the same job
|
||||||
|
@ -788,11 +792,6 @@ _conn_poll_setup_async(connectionObject *self)
|
||||||
|
|
||||||
switch (self->status) {
|
switch (self->status) {
|
||||||
case CONN_STATUS_CONNECTING:
|
case CONN_STATUS_CONNECTING:
|
||||||
/* Set the connection to nonblocking now. */
|
|
||||||
if (pq_set_non_blocking(self, 1) != 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
self->equote = conn_get_standard_conforming_strings(self->pgconn);
|
self->equote = conn_get_standard_conforming_strings(self->pgconn);
|
||||||
self->protocol = conn_get_protocol_version(self->pgconn);
|
self->protocol = conn_get_protocol_version(self->pgconn);
|
||||||
self->server_version = conn_get_server_version(self->pgconn);
|
self->server_version = conn_get_server_version(self->pgconn);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user